[−][src]Struct scale_info::Registry
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>>ⓘ where
I: IntoIterator<Item = MetaType>,
[src]
I: IntoIterator<Item = MetaType>,
Calls register_type
for each MetaType
in the given iter
pub fn map_into_compact<I, T>(&mut self, iter: I) -> Vec<T::Output>ⓘ where
I: IntoIterator<Item = T>,
T: IntoCompact,
[src]
I: IntoIterator<Item = T>,
T: IntoCompact,
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]
fn size_hint(&self) -> usize
[src]
fn encode_to<W: Output>(&self, dest: &mut W)
[src]
fn encode(&self) -> Vec<u8>ⓘ
[src]
fn using_encoded<R, F>(&self, f: F) -> R where
F: FnOnce(&[u8]) -> R,
[src]
F: FnOnce(&[u8]) -> R,
impl Eq for Registry
[src]
impl From<Registry> for RegistryReadOnly
[src]
impl PartialEq<Registry> for Registry
[src]
impl Serialize for Registry
[src]
fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error> where
__S: Serializer,
[src]
__S: Serializer,
impl StructuralEq for Registry
[src]
impl StructuralPartialEq for Registry
[src]
Auto Trait Implementations
impl RefUnwindSafe for Registry
impl Send for Registry
impl Sync for Registry
impl Unpin for Registry
impl UnwindSafe for Registry
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,
fn borrow(&self) -> &TⓘNotable traits for &'_ mut W
impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;
[src]
Notable traits for &'_ mut W
impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut TⓘNotable traits for &'_ mut W
impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;
[src]
Notable traits for &'_ mut W
impl<'_, W> Write for &'_ mut W where
W: Write + ?Sized, impl<'_, R> Read for &'_ mut R where
R: Read + ?Sized, impl<'_, I> Iterator for &'_ mut I where
I: Iterator + ?Sized, type Item = <I as Iterator>::Item;impl<'_, F> Future for &'_ mut F where
F: Unpin + Future + ?Sized, type Output = <F as Future>::Output;
impl<T, X> Encode for X where
T: Encode + ?Sized,
X: WrapperTypeEncode<Target = T>,
[src]
T: Encode + ?Sized,
X: WrapperTypeEncode<Target = T>,
fn size_hint(&self) -> usize
[src]
fn using_encoded<R, F>(&self, f: F) -> R where
F: FnOnce(&[u8]) -> R,
[src]
F: FnOnce(&[u8]) -> R,
fn encode(&self) -> Vec<u8>ⓘ
[src]
fn encode_to<W>(&self, dest: &mut W) where
W: Output,
[src]
W: Output,
impl<'_, '_, T> EncodeLike<&'_ &'_ T> for T where
T: Encode,
[src]
T: Encode,
impl<'_, T> EncodeLike<&'_ T> for T where
T: Encode,
[src]
T: Encode,
impl<'_, T> EncodeLike<&'_ mut T> for T where
T: Encode,
[src]
T: Encode,
impl<T> EncodeLike<Arc<T>> for T where
T: Encode,
[src]
T: Encode,
impl<T> EncodeLike<Box<T>> for T where
T: Encode,
[src]
T: Encode,
impl<T> EncodeLike<Rc<T>> for T where
T: Encode,
[src]
T: Encode,
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.
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>,