pub trait OpaqueType: Sized {
const TYPE_NAME: &'static str;
// Required methods
fn encode(&self) -> Bytes;
fn try_decode(data: Bytes) -> Result<Self, GenericError>;
}Expand description
A type that can be encoded into, and decoded from, an Opaque value.
Required Associated Constants§
Required Methods§
Sourcefn try_decode(data: Bytes) -> Result<Self, GenericError>
fn try_decode(data: Bytes) -> Result<Self, GenericError>
Decodes a value from the given data.
§Errors
If the data isn’t a valid encoding of this type, an error is returned.
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.