Struct numcodecs_python::Registry
source · pub struct Registry { /* private fields */ }
Expand description
Dynamic registry of codec classes.
Implementations§
source§impl Registry
impl Registry
sourcepub fn get_codec<'py>(
config: Borrowed<'_, 'py, PyDict>,
) -> Result<Bound<'py, Codec>, PyErr>
pub fn get_codec<'py>( config: Borrowed<'_, 'py, PyDict>, ) -> Result<Bound<'py, Codec>, PyErr>
Instantiate a codec from a configuration dictionary.
The config must include the id
field with the
CodecClassMethods::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<'_, '_, CodecClass>,
codec_id: Option<&str>,
) -> Result<(), PyErr>
pub fn register_codec( class: Borrowed<'_, '_, CodecClass>, codec_id: Option<&str>, ) -> Result<(), PyErr>
Register a codec class.
If the codec_id
is provided, it is used insted of
CodecClassMethods::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 Registry
impl RefUnwindSafe for Registry
impl Send for Registry
impl Sync for Registry
impl Unpin for Registry
impl UnwindSafe for Registry
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