pub struct SerializerRegistry { /* private fields */ }Expand description
Per-system registry mapping a manifest to a TypeCodec.
Implementations§
Source§impl SerializerRegistry
impl SerializerRegistry
Sourcepub fn new() -> Self
pub fn new() -> Self
Empty registry. Most callers want SerializerRegistry::standard.
Sourcepub fn standard() -> Self
pub fn standard() -> Self
Registry pre-populated with codecs for the system control payloads
(see bincode_codec::register_system_payloads).
Sourcepub fn register_codec(&self, codec: TypeCodec)
pub fn register_codec(&self, codec: TypeCodec)
Register a type with its serialization closures. The manifest
must match the Rust std::any::type_name::<T>() if you want
encode_typed::<T> to find it without an explicit manifest.
Sourcepub fn register_bincode<T>(&self)
pub fn register_bincode<T>(&self)
Convenience: register T with the bincode codec (id=1).
Sourcepub fn register_json<T>(&self)
pub fn register_json<T>(&self)
Convenience: register T with the JSON codec (id=2).
pub fn codec_for_manifest(&self, manifest: &str) -> Option<TypeCodec>
pub fn codec_for_type<T: Any>(&self) -> Option<TypeCodec>
Trait Implementations§
Source§impl Clone for SerializerRegistry
impl Clone for SerializerRegistry
Source§fn clone(&self) -> SerializerRegistry
fn clone(&self) -> SerializerRegistry
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for SerializerRegistry
impl Default for SerializerRegistry
Source§fn default() -> SerializerRegistry
fn default() -> SerializerRegistry
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for SerializerRegistry
impl !RefUnwindSafe for SerializerRegistry
impl Send for SerializerRegistry
impl Sync for SerializerRegistry
impl Unpin for SerializerRegistry
impl UnsafeUnpin for SerializerRegistry
impl !UnwindSafe for SerializerRegistry
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