Trait scrypto::prelude::CustomSchema
source · 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§
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>>
sourcefn validate_custom_type_kind(
context: &SchemaContext,
custom_type_kind: &Self::CustomTypeKind<LocalTypeId>
) -> Result<(), SchemaValidationError>
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.
sourcefn validate_custom_type_validation(
context: &SchemaContext,
custom_type_kind: &Self::CustomTypeKind<LocalTypeId>,
custom_type_validation: &Self::CustomTypeValidation
) -> Result<(), SchemaValidationError>
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.
sourcefn validate_type_metadata_with_custom_type_kind(
context: &SchemaContext,
custom_type_kind: &Self::CustomTypeKind<LocalTypeId>,
type_metadata: &TypeMetadata
) -> Result<(), SchemaValidationError>
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.
fn empty_schema() -> &'static SchemaV1<Self>
Object Safety§
This trait is not object safe.