[][src]Struct scale_info::Registry

pub struct Registry { /* fields omitted */ }

The registry for compaction of type identifiers and definitions.

The registry consists of a cache for already compactified type identifiers and definitions.

Whenever using the registry to compact a type all of its sub-types are going to be registered recursively as well. A type is a sub-type of another type if it is used by its identifier or structure.

Note

A type can be a sub-type of itself. In this case the registry has a builtin mechanism to stop recursion before going into an infinite loop.

Implementations

impl Registry[src]

pub fn new() -> Self[src]

Creates a new empty registry.

pub fn register_type(&mut self, ty: &MetaType) -> UntrackedSymbol<TypeId>[src]

Registers the given type into the registry and returns its associated type ID symbol.

Note

Due to safety requirements the returns type ID symbol cannot be used later to resolve back to the associated type definition. However, since this facility is going to be used for serialization purposes this functionality isn't needed anyway.

pub fn register_types<I>(&mut self, iter: I) -> Vec<UntrackedSymbol<TypeId>>

Notable traits for Vec<u8>

impl Write for Vec<u8>
where
    I: IntoIterator<Item = MetaType>, 
[src]

Calls register_type for each MetaType in the given iter

pub fn map_into_compact<I, T>(&mut self, iter: I) -> Vec<T::Output>

Notable traits for Vec<u8>

impl Write for Vec<u8>
where
    I: IntoIterator<Item = T>,
    T: IntoCompact
[src]

Converts an iterator into a Vec of the equivalent compact representations

Trait Implementations

impl Debug for Registry[src]

impl Default for Registry[src]

impl Encode for Registry[src]

impl Eq for Registry[src]

impl From<Registry> for RegistryReadOnly[src]

impl PartialEq<Registry> for Registry[src]

impl Serialize for Registry[src]

impl StructuralEq for Registry[src]

impl StructuralPartialEq for Registry[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T, X> Encode for X where
    T: Encode + ?Sized,
    X: WrapperTypeEncode<Target = T>, 
[src]

impl<'_, '_, T> EncodeLike<&'_ &'_ T> for T where
    T: Encode
[src]

impl<'_, T> EncodeLike<&'_ T> for T where
    T: Encode
[src]

impl<'_, T> EncodeLike<&'_ mut T> for T where
    T: Encode
[src]

impl<T> EncodeLike<Arc<T>> for T where
    T: Encode
[src]

impl<T> EncodeLike<Box<T>> for T where
    T: Encode
[src]

impl<T> EncodeLike<Rc<T>> for T where
    T: Encode
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.