pub trait Keyed {
type K: Key;
// Required method
fn key(&self) -> Self::K;
}Expand description
Data sample must implement Keyed to be used in a WITH_KEY topic.
It allows a Key to be extracted from the sample. In its simplest form, the key may be just a part of the sample data, but it can be anything computable from an immutable sample by an application-defined function. It is recommended that this function be lightweight to compute.
The key is used to distinguish between different Instances of the data in a DDS Topic.
A Keyed type has an associated type K, which is the corresponding key
type. K must implement Key. Otherwise, K can be chosen to suit the
application. It is advisable that K is something that can be cloned with
reasonable effort.
Required Associated Types§
Required Methods§
Implementations on Foreign Types§
source§impl<D: Keyed> Keyed for &D
impl<D: Keyed> Keyed for &D
Key for a reference type &D is the same as for the value type D.
This is required internally for the implementation of NoKey topics.