pub trait CustomSchema: Debug + Clone + Copy + PartialEq + Eq + 'static {
    type CustomTypeValidation: CustomTypeValidation;
    type CustomTypeKind<L: SchemaTypeLink>: CustomTypeKind<L, CustomTypeValidation = Self::CustomTypeValidation>;

    // Required methods
    fn linearize_type_kind(
        type_kind: Self::CustomTypeKind<RustTypeId>,
        type_indices: &IndexSet<[u8; 20]>
    ) -> Self::CustomTypeKind<LocalTypeId>;
    fn resolve_well_known_type(
        well_known_id: WellKnownTypeId
    ) -> Option<&'static TypeData<Self::CustomTypeKind<LocalTypeId>, LocalTypeId>>;
    fn validate_custom_type_kind(
        context: &SchemaContext,
        custom_type_kind: &Self::CustomTypeKind<LocalTypeId>
    ) -> Result<(), SchemaValidationError>;
    fn validate_custom_type_validation(
        context: &SchemaContext,
        custom_type_kind: &Self::CustomTypeKind<LocalTypeId>,
        custom_type_validation: &Self::CustomTypeValidation
    ) -> Result<(), SchemaValidationError>;
    fn validate_type_metadata_with_custom_type_kind(
        context: &SchemaContext,
        custom_type_kind: &Self::CustomTypeKind<LocalTypeId>,
        type_metadata: &TypeMetadata
    ) -> Result<(), SchemaValidationError>;
    fn empty_schema() -> &'static SchemaV1<Self>;
}

Required Associated Types§

Required Methods§

source

fn linearize_type_kind( type_kind: Self::CustomTypeKind<RustTypeId>, type_indices: &IndexSet<[u8; 20]> ) -> Self::CustomTypeKind<LocalTypeId>

source

fn resolve_well_known_type( well_known_id: WellKnownTypeId ) -> Option<&'static TypeData<Self::CustomTypeKind<LocalTypeId>, LocalTypeId>>

source

fn validate_custom_type_kind( context: &SchemaContext, custom_type_kind: &Self::CustomTypeKind<LocalTypeId> ) -> Result<(), SchemaValidationError>

Used when validating schemas are self-consistent.

Verifies if the custom type kind is valid within the schema context, e.g. to check if an offset is out of bounds.

source

fn validate_custom_type_validation( context: &SchemaContext, custom_type_kind: &Self::CustomTypeKind<LocalTypeId>, custom_type_validation: &Self::CustomTypeValidation ) -> Result<(), SchemaValidationError>

Used when validating schemas are self-consistent.

Verifies if the custom type validation is appropriate for the custom type kind. Note that custom type validation can only be associated with custom type kind.

source

fn validate_type_metadata_with_custom_type_kind( context: &SchemaContext, custom_type_kind: &Self::CustomTypeKind<LocalTypeId>, type_metadata: &TypeMetadata ) -> Result<(), SchemaValidationError>

Used when validating schemas are self-consistent.

Verifies if the metadata is appropriate for the custom type kind.

source

fn empty_schema() -> &'static SchemaV1<Self>

Object Safety§

This trait is not object safe.

Implementors§