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§
sourcetype SerializationError: IntoAnyError
type SerializationError: IntoAnyError
Error type of the underlying serializer that can convert this type into a Vec<u8>
.
sourcetype DeserializationError: IntoAnyError
type DeserializationError: IntoAnyError
Error type of the underlying deserializer that can convert a Vec<u8>
into this type.
Required Methods§
sourcefn extension_type() -> ExtensionType
fn extension_type() -> ExtensionType
Extension type value that this type represents.
sourcefn to_bytes(&self) -> Result<Vec<u8>, Self::SerializationError>
fn to_bytes(&self) -> Result<Vec<u8>, Self::SerializationError>
Convert this type to opaque bytes.
sourcefn from_bytes(data: &[u8]) -> Result<Self, Self::DeserializationError>
fn from_bytes(data: &[u8]) -> Result<Self, Self::DeserializationError>
Create this type from opaque bytes.
Provided Methods§
sourcefn into_extension(self) -> Result<Extension, ExtensionError>
fn into_extension(self) -> Result<Extension, ExtensionError>
Convert this type into an Extension.
sourcefn from_extension(ext: &Extension) -> Result<Self, ExtensionError>
fn from_extension(ext: &Extension) -> Result<Self, ExtensionError>
Create this type from an Extension.
Object Safety§
This trait is not object safe.