pub struct CodecRegistry { /* private fields */ }Expand description
Registry for codecs.
Allows runtime selection of encoding/decoding algorithms and registration of custom codec implementations.
Implementations§
Source§impl CodecRegistry
impl CodecRegistry
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new codec registry with default codecs.
Default codecs:
- RAW (0x55)
- DAG-CBOR (0x71)
- DAG-JSON (0x0129)
Sourcepub fn register(&self, codec: Arc<dyn Codec>)
pub fn register(&self, codec: Arc<dyn Codec>)
Register a codec implementation.
If a codec with the same code already exists, it will be replaced.
Sourcepub fn list_codecs(&self) -> Vec<u64>
pub fn list_codecs(&self) -> Vec<u64>
List all registered codec codes.
Trait Implementations§
Source§impl Clone for CodecRegistry
impl Clone for CodecRegistry
Source§fn clone(&self) -> CodecRegistry
fn clone(&self) -> CodecRegistry
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 moreAuto Trait Implementations§
impl Freeze for CodecRegistry
impl RefUnwindSafe for CodecRegistry
impl Send for CodecRegistry
impl Sync for CodecRegistry
impl Unpin for CodecRegistry
impl UnwindSafe for CodecRegistry
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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