Trait mls_rs::extension::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.

Object Safety§

This trait is not object safe.

Implementors§