Trait CustomSchema

Source
pub trait CustomSchema:
    Debug
    + Clone
    + Copy
    + PartialEq
    + Eq
    + 'static {
    type CustomTypeValidation: CustomTypeValidation + VecSbor<Self::DefaultCustomExtension>;
    type CustomLocalTypeKind: CustomTypeKind<LocalTypeId, CustomTypeValidation = Self::CustomTypeValidation, CustomTypeKindLabel = Self::CustomTypeKindLabel> + VecSbor<Self::DefaultCustomExtension>;
    type CustomAggregatorTypeKind: CustomTypeKind<RustTypeId, CustomTypeValidation = Self::CustomTypeValidation, CustomTypeKindLabel = Self::CustomTypeKindLabel>;
    type CustomTypeKindLabel: CustomTypeKindLabel;
    type DefaultCustomExtension: ValidatableCustomExtension<(), CustomSchema = Self>;

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

Required Associated Types§

Source

type CustomTypeValidation: CustomTypeValidation + VecSbor<Self::DefaultCustomExtension>

Source

type CustomLocalTypeKind: CustomTypeKind<LocalTypeId, CustomTypeValidation = Self::CustomTypeValidation, CustomTypeKindLabel = Self::CustomTypeKindLabel> + VecSbor<Self::DefaultCustomExtension>

Source

type CustomAggregatorTypeKind: CustomTypeKind<RustTypeId, CustomTypeValidation = Self::CustomTypeValidation, CustomTypeKindLabel = Self::CustomTypeKindLabel>

Source

type CustomTypeKindLabel: CustomTypeKindLabel

Source

type DefaultCustomExtension: ValidatableCustomExtension<(), CustomSchema = Self>

Should only be used for default encoding of a schema, where it’s required. Typically you should start from a CustomExtension and not use this.

Required Methods§

Source

fn linearize_type_kind( type_kind: Self::CustomAggregatorTypeKind, type_indices: &IndexSet<[u8; 20]>, ) -> Self::CustomLocalTypeKind

Source

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

Source

fn validate_custom_type_kind( context: &SchemaContext, custom_type_kind: &Self::CustomLocalTypeKind, ) -> 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::CustomLocalTypeKind, 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::CustomLocalTypeKind, 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>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§