pub struct SchemaV1<S>where
S: CustomSchema,{
pub type_kinds: Vec<TypeKind<<S as CustomSchema>::CustomTypeKind<LocalTypeId>, 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>::CustomTypeKind<LocalTypeId>, 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>::CustomTypeKind<LocalTypeId>, 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 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>::CustomTypeKind<LocalTypeId>: Decode<X, D> + Categorize<X>,
<S as CustomSchema>::CustomTypeValidation: Decode<X, D> + Categorize<X>,
impl<S, D, X> Decode<X, D> for SchemaV1<S>where
S: CustomSchema,
D: Decoder<X>,
X: CustomValueKind,
<S as CustomSchema>::CustomTypeKind<LocalTypeId>: Decode<X, D> + Categorize<X>,
<S as CustomSchema>::CustomTypeValidation: Decode<X, D> + Categorize<X>,
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>::CustomTypeKind<LocalTypeId>: 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>::CustomTypeKind<LocalTypeId>: 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>::CustomTypeKind<LocalTypeId>: Encode<X, E> + Categorize<X>,
<S as CustomSchema>::CustomTypeValidation: Encode<X, E> + Categorize<X>,
impl<S, E, X> Encode<X, E> for SchemaV1<S>where
S: CustomSchema,
E: Encoder<X>,
X: CustomValueKind,
<S as CustomSchema>::CustomTypeKind<LocalTypeId>: Encode<X, E> + Categorize<X>,
<S as CustomSchema>::CustomTypeValidation: Encode<X, E> + Categorize<X>,
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 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> PartialEq for SchemaV1<S>
impl<S> PartialEq for SchemaV1<S>
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,
type Versioned = VersionedSchema<S>
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> RefUnwindSafe for SchemaV1<S>where
<S as CustomSchema>::CustomTypeKind<LocalTypeId>: RefUnwindSafe,
<S as CustomSchema>::CustomTypeValidation: RefUnwindSafe,
impl<S> Send for SchemaV1<S>where
<S as CustomSchema>::CustomTypeKind<LocalTypeId>: Send,
<S as CustomSchema>::CustomTypeValidation: Send,
impl<S> Sync for SchemaV1<S>where
<S as CustomSchema>::CustomTypeKind<LocalTypeId>: Sync,
<S as CustomSchema>::CustomTypeValidation: Sync,
impl<S> Unpin for SchemaV1<S>where
<S as CustomSchema>::CustomTypeKind<LocalTypeId>: Unpin,
<S as CustomSchema>::CustomTypeValidation: Unpin,
impl<S> UnwindSafe for SchemaV1<S>where
<S as CustomSchema>::CustomTypeKind<LocalTypeId>: UnwindSafe,
<S as CustomSchema>::CustomTypeValidation: UnwindSafe,
Blanket Implementations§
§impl<U> As for U
impl<U> As for U
§fn as_<T>(self) -> Twhere
T: CastFrom<U>,
fn as_<T>(self) -> Twhere
T: CastFrom<U>,
Casts
self
to type T
. The semantics of numeric casting with the as
operator are followed, so <T as As>::as_::<U>
can be used in the same way as T as U
for numeric conversions. Read moresource§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<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.§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more