mls_rs::extension

Trait MlsExtension

Source
pub trait MlsExtension: Sized {
    type SerializationError: IntoAnyError;
    type DeserializationError: IntoAnyError;

    // Required methods
    fn extension_type() -> ExtensionType;
    fn to_bytes(&self) -> Result<Vec<u8>, Self::SerializationError>;
    fn from_bytes(data: &[u8]) -> Result<Self, Self::DeserializationError>;

    // Provided methods
    fn into_extension(self) -> Result<Extension, ExtensionError> { ... }
    fn from_extension(ext: &Extension) -> Result<Self, ExtensionError> { ... }
}
Expand description

Trait used to convert a type to and from an Extension

Required Associated Types§

Source

type SerializationError: IntoAnyError

Error type of the underlying serializer that can convert this type into a Vec<u8>.

Source

type DeserializationError: IntoAnyError

Error type of the underlying deserializer that can convert a Vec<u8> into this type.

Required Methods§

Source

fn extension_type() -> ExtensionType

Extension type value that this type represents.

Source

fn to_bytes(&self) -> Result<Vec<u8>, Self::SerializationError>

Convert this type to opaque bytes.

Source

fn from_bytes(data: &[u8]) -> Result<Self, Self::DeserializationError>

Create this type from opaque bytes.

Provided Methods§

Source

fn into_extension(self) -> Result<Extension, ExtensionError>

Convert this type into an Extension.

Source

fn from_extension(ext: &Extension) -> Result<Self, ExtensionError>

Create this type from an Extension.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§