pub struct CodecRegistry { /* private fields */ }Expand description
Holds every codec known to a running engine. Codec crates call
register to add themselves.
Implementations§
Source§impl CodecRegistry
impl CodecRegistry
pub fn new() -> CodecRegistry
Sourcepub fn register(&mut self, codec: Codec)
pub fn register(&mut self, codec: Codec)
Register a codec. A later registration for the same CodecId replaces
the earlier one (lets downstreams override a built-in).
Sourcepub fn find_decoder(&self, id: CodecId) -> Result<Box<dyn Decoder>>
pub fn find_decoder(&self, id: CodecId) -> Result<Box<dyn Decoder>>
Instantiate a decoder for id, or Error::DecoderNotFound.
Sourcepub fn find_encoder(&self, id: CodecId) -> Result<Box<dyn Encoder>>
pub fn find_encoder(&self, id: CodecId) -> Result<Box<dyn Encoder>>
Instantiate an encoder for id, or Error::EncoderNotFound.
Sourcepub fn by_name(&self, name: &str) -> Option<&Codec>
pub fn by_name(&self, name: &str) -> Option<&Codec>
Look up a codec descriptor by its canonical name.
Sourcepub fn iter(&self) -> impl Iterator<Item = &Codec>
pub fn iter(&self) -> impl Iterator<Item = &Codec>
Iterate all registered codecs (order unspecified).
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Freeze for CodecRegistry
impl RefUnwindSafe for CodecRegistry
impl Send for CodecRegistry
impl Sync for CodecRegistry
impl Unpin for CodecRegistry
impl UnsafeUnpin 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