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.
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.