[][src]Struct scale_info::Registry

pub struct Registry { /* fields omitted */ }

The registry for space-efficient storage of type identifiers and definitions.

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

When adding a type to the registry, all of its sub-types are registered recursively as well. A type is considered 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 and avoid 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, Global>

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

Calls register_type for each MetaType in the given iter.

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

Notable traits for Vec<u8, Global>

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

Converts an iterator into a Vec of the equivalent portable representations.

Trait Implementations

impl Debug for Registry[src]

impl Default for Registry[src]

impl Eq for Registry[src]

impl From<Registry> for PortableRegistry[src]

impl PartialEq<Registry> 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> 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.