Skip to main content

PyCodecClassMethods

Trait PyCodecClassMethods 

Source
pub trait PyCodecClassMethods<'py>: Sealed {
    // Required methods
    fn codec_id(&self) -> Result<String, PyErr>;
    fn codec_from_config(
        &self,
        config: Borrowed<'_, 'py, PyDict>,
    ) -> Result<Bound<'py, PyCodec>, PyErr>;
    fn as_type(&self) -> &Bound<'py, PyType>;
}
Expand description

Methods implemented for PyCodecClasses.

Required Methods§

Source

fn codec_id(&self) -> Result<String, PyErr>

Gets the codec identifier.

§Errors

Errors if the codec does not provide an identifier.

Source

fn codec_from_config( &self, config: Borrowed<'_, 'py, PyDict>, ) -> Result<Bound<'py, PyCodec>, PyErr>

Instantiate a codec from a configuration dictionary.

The config dict must not contain an id field.

§Errors

Errors if constructing the codec fails.

Source

fn as_type(&self) -> &Bound<'py, PyType>

Gets the PyType that this PyCodecClass represents.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<'py> PyCodecClassMethods<'py> for Bound<'py, PyCodecClass>

Source§

fn codec_id(&self) -> Result<String, PyErr>

Source§

fn codec_from_config( &self, config: Borrowed<'_, 'py, PyDict>, ) -> Result<Bound<'py, PyCodec>, PyErr>

Source§

fn as_type(&self) -> &Bound<'py, PyType>

Implementors§