Trait rustdds::dds::adapters::with_key::DeserializerAdapter

source ·
pub trait DeserializerAdapter<D>: DeserializerAdapter<D>
where D: Keyed,
{ type DecodedKey; // Required method fn transform_decoded_key(decoded_key: Self::DecodedKey) -> D::K; // Provided methods fn key_from_bytes_with<S>( input_bytes: &[u8], encoding: RepresentationIdentifier, decoder: S ) -> Result<D::K, S::Error> where S: Decode<Self::Decoded, Self::DecodedKey> { ... } fn key_from_bytes( input_bytes: &[u8], encoding: RepresentationIdentifier ) -> Result<D::K, Self::Error> where Self: DefaultDecoder<D> { ... } }
Expand description

trait for connecting a Deserializer implementation and DataReader together - with_key version.

The keyed versions inherit the no_key versions, but here the payload type D implements Keyed, which means that thre is an associated key type D::K. The with_key versions extend the deserialization functionality to also handle that key type.

with_key functionality is needed in DDS topics that have a key, e.g. DDS Discovery topics. ROS 2 (as of Iron Irwini) has no concept of with_key topics.

Required Associated Types§

source

type DecodedKey

Key type after decoding and before transformation.

The adapter might apply additional operations or wrapper types to the decoded value, so this type might be different from D.

Required Methods§

source

fn transform_decoded_key(decoded_key: Self::DecodedKey) -> D::K

Transform the Self::DecodedKey type returned by the decoder into a value of type D.

If Self::DecodedKey is set to D, this method can be the identity function.

Provided Methods§

source

fn key_from_bytes_with<S>( input_bytes: &[u8], encoding: RepresentationIdentifier, decoder: S ) -> Result<D::K, S::Error>
where S: Decode<Self::Decoded, Self::DecodedKey>,

Deserialize data from bytes to an object using the given decoder.

encoding must be something given by supported_encodings(), or implementation may fail with Err or panic!().

source

fn key_from_bytes( input_bytes: &[u8], encoding: RepresentationIdentifier ) -> Result<D::K, Self::Error>
where Self: DefaultDecoder<D>,

Deserialize data from bytes to an object. encoding must be something given by supported_encodings(), or implementation may fail with Err or panic!().

Only usable if the adapter has a default decoder.

Object Safety§

This trait is not object safe.

Implementors§