pub struct GlobalRegistry;Expand description
Global registry singleton.
If the global registry is used, its backing registry must be provided
exactly once using export_global.
The global registry must not be used to provide the backing of itself, which would result in an infinite loop at runtime.
Implementations§
Source§impl GlobalRegistry
impl GlobalRegistry
Sourcepub fn codec_from_config<'de, D: Deserializer<'de>>(
config: D,
) -> Result<ErasedDynCodec, D::Error>
pub fn codec_from_config<'de, D: Deserializer<'de>>( config: D, ) -> Result<ErasedDynCodec, D::Error>
Deserialize an ErasedDynCodec from its config by looking up the
codec id in the GlobalRegistry.
The config must include the id field with the
[DynCodecType::codec_id].
§Errors
Errors if no codec with a matching id has been registered, or if
constructing the codec fails.
Trait Implementations§
Source§impl Registry for GlobalRegistry
impl Registry for GlobalRegistry
Source§type Error = ErasedError
type Error = ErasedError
Error type that may be returned during
get_codec.Source§fn get_codec<'de, D: Deserializer<'de>>(
&self,
config: D,
) -> Result<ErasedDynCodec, Self::Error>
fn get_codec<'de, D: Deserializer<'de>>( &self, config: D, ) -> Result<ErasedDynCodec, Self::Error>
Instantiate a codec of any type from its
configuration. Read moreSource§fn get_codec_typed<'de, T: DynCodec, D: Deserializer<'de>>(
&self,
config: D,
) -> Result<Option<T>, Self::Error>
fn get_codec_typed<'de, T: DynCodec, D: Deserializer<'de>>( &self, config: D, ) -> Result<Option<T>, Self::Error>
Instantiate a codec with a concrete type from its
configuration. Read moreAuto Trait Implementations§
impl Freeze for GlobalRegistry
impl RefUnwindSafe for GlobalRegistry
impl Send for GlobalRegistry
impl Sync for GlobalRegistry
impl Unpin for GlobalRegistry
impl UnsafeUnpin for GlobalRegistry
impl UnwindSafe for GlobalRegistry
Blanket Implementations§
Source§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<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more