pub struct PyCodecRegistry { /* private fields */ }
Expand description
Dynamic registry of codec classes.
Implementations§
Source§impl PyCodecRegistry
impl PyCodecRegistry
Sourcepub fn get_codec<'py>(
config: Borrowed<'_, 'py, PyDict>,
) -> Result<Bound<'py, PyCodec>, PyErr>
pub fn get_codec<'py>( config: Borrowed<'_, 'py, PyDict>, ) -> Result<Bound<'py, PyCodec>, PyErr>
Instantiate a codec from a configuration dictionary.
The config must include the id
field with the
PyCodecClassMethods::codec_id
.
§Errors
Errors if no codec with a matching id
has been registered, or if
constructing the codec fails.
Sourcepub fn register_codec(
class: Borrowed<'_, '_, PyCodecClass>,
codec_id: Option<&str>,
) -> Result<(), PyErr>
pub fn register_codec( class: Borrowed<'_, '_, PyCodecClass>, codec_id: Option<&str>, ) -> Result<(), PyErr>
Register a codec class.
If the codec_id
is provided, it is used instead of
PyCodecClassMethods::codec_id
.
This function maintains a mapping from codec identifiers to codec classes. When a codec class is registered, it will replace any class previously registered under the same codec identifier, if present.
§Errors
Errors if registering the codec class fails.
Auto Trait Implementations§
impl Freeze for PyCodecRegistry
impl RefUnwindSafe for PyCodecRegistry
impl Send for PyCodecRegistry
impl Sync for PyCodecRegistry
impl Unpin for PyCodecRegistry
impl UnwindSafe for PyCodecRegistry
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