pub trait DeserializerAdapter<D> {
type Error: Error;
// Required methods
fn supported_encodings() -> &'static [RepresentationIdentifier];
fn from_bytes(
input_bytes: &[u8],
encoding: RepresentationIdentifier
) -> Result<D, Self::Error>;
// Provided method
fn from_vec_bytes(
input_vec_bytes: &[Bytes],
encoding: RepresentationIdentifier
) -> Result<D, Self::Error> { ... }
}
Expand description
trait for connecting a Deserializer implementation and DataReader together - no_key version.
Required Associated Types§
Required Methods§
sourcefn supported_encodings() -> &'static [RepresentationIdentifier]
fn supported_encodings() -> &'static [RepresentationIdentifier]
Which data representations can the DeserializerAdapter read? See RTPS specification Section 10 and Table 10.3
sourcefn from_bytes(
input_bytes: &[u8],
encoding: RepresentationIdentifier
) -> Result<D, Self::Error>
fn from_bytes( input_bytes: &[u8], encoding: RepresentationIdentifier ) -> Result<D, Self::Error>
Deserialize data from bytes to an object.
encoding
must be something given by supported_encodings()
, or
implementation may fail with Err or panic!()
.
Provided Methods§
sourcefn from_vec_bytes(
input_vec_bytes: &[Bytes],
encoding: RepresentationIdentifier
) -> Result<D, Self::Error>
fn from_vec_bytes( input_vec_bytes: &[Bytes], encoding: RepresentationIdentifier ) -> Result<D, Self::Error>
This method has a default implementation, but the default will make a copy of all the input data in memory and then call from_bytes() .
Object Safety§
This trait is not object safe.