pub struct SchemaV1<S>where
S: CustomSchema,{
pub type_kinds: Vec<TypeKind<<S as CustomSchema>::CustomLocalTypeKind, LocalTypeId>>,
pub type_metadata: Vec<TypeMetadata>,
pub type_validations: Vec<TypeValidation<<S as CustomSchema>::CustomTypeValidation>>,
}
Expand description
An array of custom type kinds, and associated extra information which can attach to the type kinds
Fields§
§type_kinds: Vec<TypeKind<<S as CustomSchema>::CustomLocalTypeKind, LocalTypeId>>
§type_metadata: Vec<TypeMetadata>
§type_validations: Vec<TypeValidation<<S as CustomSchema>::CustomTypeValidation>>
Implementations§
Source§impl<S> SchemaV1<S>where
S: CustomSchema,
impl<S> SchemaV1<S>where
S: CustomSchema,
pub fn empty() -> SchemaV1<S>
pub fn resolve_type_kind( &self, type_id: LocalTypeId, ) -> Option<&TypeKind<<S as CustomSchema>::CustomLocalTypeKind, LocalTypeId>>
pub fn resolve_type_metadata( &self, type_id: LocalTypeId, ) -> Option<&TypeMetadata>
pub fn resolve_matching_tuple_metadata( &self, type_id: LocalTypeId, fields_length: usize, ) -> TupleData<'_>
pub fn resolve_matching_enum_metadata<'s>( &self, type_id: LocalTypeId, variant_id: u8, fields_length: usize, ) -> EnumVariantData<'_>
pub fn resolve_matching_array_metadata( &self, type_id: LocalTypeId, ) -> ArrayData<'_>
pub fn resolve_matching_map_metadata(&self, type_id: LocalTypeId) -> MapData<'_>
pub fn resolve_type_name_from_metadata( &self, type_id: LocalTypeId, ) -> Option<&str>
pub fn resolve_type_validation( &self, type_id: LocalTypeId, ) -> Option<&TypeValidation<<S as CustomSchema>::CustomTypeValidation>>
pub fn resolve_type_data( &self, type_id: LocalTypeId, ) -> Option<(&TypeKind<<S as CustomSchema>::CustomLocalTypeKind, LocalTypeId>, &TypeMetadata, &TypeValidation<<S as CustomSchema>::CustomTypeValidation>)>
pub fn validate(&self) -> Result<(), SchemaValidationError>
Trait Implementations§
Source§impl<S, X> Categorize<X> for SchemaV1<S>where
S: CustomSchema,
X: CustomValueKind,
impl<S, X> Categorize<X> for SchemaV1<S>where
S: CustomSchema,
X: CustomValueKind,
fn value_kind() -> ValueKind<X>
Source§impl<S, D, X> Decode<X, D> for SchemaV1<S>where
S: CustomSchema,
D: Decoder<X>,
X: CustomValueKind,
<S as CustomSchema>::CustomLocalTypeKind: Decode<X, D>,
<S as CustomSchema>::CustomTypeValidation: Decode<X, D>,
impl<S, D, X> Decode<X, D> for SchemaV1<S>where
S: CustomSchema,
D: Decoder<X>,
X: CustomValueKind,
<S as CustomSchema>::CustomLocalTypeKind: Decode<X, D>,
<S as CustomSchema>::CustomTypeValidation: Decode<X, D>,
Source§fn decode_body_with_value_kind(
decoder: &mut D,
value_kind: ValueKind<X>,
) -> Result<SchemaV1<S>, DecodeError>
fn decode_body_with_value_kind( decoder: &mut D, value_kind: ValueKind<X>, ) -> Result<SchemaV1<S>, DecodeError>
Decodes the type from the decoder, which should match a preloaded value kind. Read more
Source§impl<S> Default for SchemaV1<S>where
S: CustomSchema,
impl<S> Default for SchemaV1<S>where
S: CustomSchema,
Source§impl<S, C> Describe<C> for SchemaV1<S>where
S: CustomSchema,
C: CustomTypeKind<RustTypeId>,
<S as CustomSchema>::CustomLocalTypeKind: Describe<C>,
<S as CustomSchema>::CustomTypeValidation: Describe<C>,
impl<S, C> Describe<C> for SchemaV1<S>where
S: CustomSchema,
C: CustomTypeKind<RustTypeId>,
<S as CustomSchema>::CustomLocalTypeKind: Describe<C>,
<S as CustomSchema>::CustomTypeValidation: Describe<C>,
Source§const TYPE_ID: RustTypeId
const TYPE_ID: RustTypeId
The
TYPE_ID
should give a unique identifier for its SBOR schema type.
An SBOR schema type capture details about the SBOR payload, how it should be interpreted, validated and displayed. Read moreSource§fn type_data() -> TypeData<C, RustTypeId>
fn type_data() -> TypeData<C, RustTypeId>
Returns the local schema for the given type. Read more
Source§fn add_all_dependencies(aggregator: &mut TypeAggregator<C>)
fn add_all_dependencies(aggregator: &mut TypeAggregator<C>)
For each type referenced in
get_local_type_data
, we need to ensure that the type and all of its own references
get added to the aggregator. Read moreSource§impl<S, E, X> Encode<X, E> for SchemaV1<S>where
S: CustomSchema,
E: Encoder<X>,
X: CustomValueKind,
<S as CustomSchema>::CustomLocalTypeKind: Encode<X, E>,
<S as CustomSchema>::CustomTypeValidation: Encode<X, E>,
impl<S, E, X> Encode<X, E> for SchemaV1<S>where
S: CustomSchema,
E: Encoder<X>,
X: CustomValueKind,
<S as CustomSchema>::CustomLocalTypeKind: Encode<X, E>,
<S as CustomSchema>::CustomTypeValidation: Encode<X, E>,
Source§fn encode_value_kind(&self, encoder: &mut E) -> Result<(), EncodeError>
fn encode_value_kind(&self, encoder: &mut E) -> Result<(), EncodeError>
Encodes the SBOR value’s kind to the encoder
Source§fn encode_body(&self, encoder: &mut E) -> Result<(), EncodeError>
fn encode_body(&self, encoder: &mut E) -> Result<(), EncodeError>
Encodes the SBOR body of the type to the encoder. Read more
Source§impl<S> From<SchemaV1<S>> for SchemaVersions<S>where
S: CustomSchema,
impl<S> From<SchemaV1<S>> for SchemaVersions<S>where
S: CustomSchema,
Source§fn from(value: SchemaV1<S>) -> SchemaVersions<S>
fn from(value: SchemaV1<S>) -> SchemaVersions<S>
Converts to this type from the input type.
Source§impl<S> From<SchemaV1<S>> for VersionedSchema<S>where
S: CustomSchema,
impl<S> From<SchemaV1<S>> for VersionedSchema<S>where
S: CustomSchema,
Source§fn from(value: SchemaV1<S>) -> VersionedSchema<S>
fn from(value: SchemaV1<S>) -> VersionedSchema<S>
Converts to this type from the input type.
Source§impl<S, X> SborTuple<X> for SchemaV1<S>where
S: CustomSchema,
X: CustomValueKind,
impl<S, X> SborTuple<X> for SchemaV1<S>where
S: CustomSchema,
X: CustomValueKind,
fn get_length(&self) -> usize
Source§impl<S> VersionedSchemaVersion for SchemaV1<S>where
S: CustomSchema,
impl<S> VersionedSchemaVersion for SchemaV1<S>where
S: CustomSchema,
const DISCRIMINATOR: u8 = 0u8
type Versioned = VersionedSchema<S>
type OwnedSborVariant = SborFixedEnumVariant<sbor::::schema::schema::{impl#16}::OwnedSborVariant::{constant#0}, (SchemaV1<S>,)>
type BorrowedSborVariant<'a> = SborFixedEnumVariant<sbor::::schema::schema::{impl#16}::BorrowedSborVariant::{constant#0}, (&'a SchemaV1<S>,)> where SchemaV1<S>: 'a
Source§fn as_encodable_variant(
&self,
) -> <SchemaV1<S> as VersionedSchemaVersion>::BorrowedSborVariant<'_>
fn as_encodable_variant( &self, ) -> <SchemaV1<S> as VersionedSchemaVersion>::BorrowedSborVariant<'_>
Can be used to encode the type as a variant under the Versioned type, without
needing to clone, like this:
encoder.encode(x.as_encodable_variant())
.Source§fn from_decoded_variant(
variant: <SchemaV1<S> as VersionedSchemaVersion>::OwnedSborVariant,
) -> SchemaV1<S>
fn from_decoded_variant( variant: <SchemaV1<S> as VersionedSchemaVersion>::OwnedSborVariant, ) -> SchemaV1<S>
Can be used to decode the type from an encoded variant, like this:
X::from_decoded_variant(decoder.decode()?)
.fn into_versioned(self) -> <SchemaV1<S> as VersionedSchemaVersion>::Versioned
impl<S> Eq for SchemaV1<S>
impl<S> StructuralPartialEq for SchemaV1<S>where
S: CustomSchema,
Auto Trait Implementations§
impl<S> Freeze for SchemaV1<S>
impl<S> RefUnwindSafe for SchemaV1<S>where
<S as CustomSchema>::CustomLocalTypeKind: RefUnwindSafe,
<S as CustomSchema>::CustomTypeValidation: RefUnwindSafe,
impl<S> Send for SchemaV1<S>where
<S as CustomSchema>::CustomLocalTypeKind: Send,
<S as CustomSchema>::CustomTypeValidation: Send,
impl<S> Sync for SchemaV1<S>where
<S as CustomSchema>::CustomLocalTypeKind: Sync,
<S as CustomSchema>::CustomTypeValidation: Sync,
impl<S> Unpin for SchemaV1<S>where
<S as CustomSchema>::CustomLocalTypeKind: Unpin,
<S as CustomSchema>::CustomTypeValidation: Unpin,
impl<S> UnwindSafe for SchemaV1<S>where
<S as CustomSchema>::CustomLocalTypeKind: UnwindSafe,
<S as CustomSchema>::CustomTypeValidation: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T, U> ContextualTryInto<U> for Twhere
U: ContextualTryFrom<T>,
impl<T, U> ContextualTryInto<U> for Twhere
U: ContextualTryFrom<T>,
type Error = <U as ContextualTryFrom<T>>::Error
type Context = <U as ContextualTryFrom<T>>::Context
fn contextual_try_into( self, context: &<U as ContextualTryFrom<T>>::Context, ) -> Result<U, <U as ContextualTryFrom<T>>::Error>
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.