[−][src]Struct scale_info::Registry
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>>ⓘ where
I: IntoIterator<Item = MetaType>,
[src]
I: IntoIterator<Item = MetaType>,
Calls register_type
for each MetaType
in the given iter
.
pub fn map_into_portable<I, T>(&mut self, iter: I) -> Vec<T::Output>ⓘ where
I: IntoIterator<Item = T>,
T: IntoPortable,
[src]
I: IntoIterator<Item = T>,
T: IntoPortable,
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
impl RefUnwindSafe for Registry
[src]
impl Send for Registry
[src]
impl Sync for Registry
[src]
impl Unpin for Registry
[src]
impl UnwindSafe for Registry
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,