Trait MessageMetadata

Source
pub trait MessageMetadata:
    Debug
    + Send
    + Sync
    + 'static {
    type PeerId: Default + Display + Debug + Hash + Eq + Copy + Ord + Serialize + DeserializeOwned + Send + Sync + 'static;
    type MessageId: Num + NumOps + Eq + Default + PartialEq + Display + Debug + Hash + Ord + PartialOrd + Copy + Serialize + DeserializeOwned + Send + Sync + 'static;
    type Contents: Send + Sync + 'static;

    // Required methods
    fn source_id(&self) -> Self::PeerId;
    fn destination_id(&self) -> Self::PeerId;
    fn message_id(&self) -> Self::MessageId;
    fn contents(&self) -> &Self::Contents;
    fn construct_from_parts(
        source_id: Self::PeerId,
        destination_id: Self::PeerId,
        message_id: Self::MessageId,
        contents: impl Into<Self::Contents>,
    ) -> Self;
}

Required Associated Types§

Required Methods§

Source

fn source_id(&self) -> Self::PeerId

Source

fn destination_id(&self) -> Self::PeerId

Source

fn message_id(&self) -> Self::MessageId

Source

fn contents(&self) -> &Self::Contents

Source

fn construct_from_parts( source_id: Self::PeerId, destination_id: Self::PeerId, message_id: Self::MessageId, contents: impl Into<Self::Contents>, ) -> Self

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.

Implementors§