[][src]Struct timely_communication::message::Message

pub struct Message<T> { /* fields omitted */ }

A wrapped message which may be either typed or binary data.

Methods

impl<T> Message<T>[src]

pub fn from_typed(typed: T) -> Self[src]

Wrap a typed item as a message.

pub fn from_arc(typed: Arc<T>) -> Self[src]

Wrap a shared typed item as a message.

pub fn if_typed(self) -> Option<T>[src]

Destructures and returns any typed data.

pub fn if_mut(&mut self) -> Option<&mut T>[src]

Returns a mutable reference, if typed.

pub fn as_ref_or_mut(&mut self) -> RefOrMut<T>[src]

Returns an immutable or mutable typed reference.

This method returns a mutable reference if the underlying data are typed Rust instances, which admit mutation, and it returns an immutable reference if the data are serialized binary data.

impl<T: Data> Message<T>[src]

pub unsafe fn from_bytes(bytes: Bytes) -> Self[src]

Wrap bytes as a message.

Safety

This method is unsafe, in that Abomonated::new() is unsafe: it presumes that the binary data can be safely decoded, which is unsafe for e.g. UTF8 data and enumerations (perhaps among many other types).

pub fn length_in_bytes(&self) -> usize[src]

The number of bytes required to serialize the data.

pub fn into_bytes<W: Write>(&self, writer: &mut W)[src]

Writes the binary representation into writer.

impl<T: Clone> Message<T>[src]

pub fn into_typed(self) -> T[src]

Produces a typed instance of the wrapped element.

pub fn as_mut(&mut self) -> &mut T[src]

Ensures the message is typed data and returns a mutable reference to it.

Trait Implementations

impl<T: Data, P: BytesPush> Push<Message<T>> for Pusher<T, P>[src]

impl<T: Data> Pull<Message<T>> for Puller<T>[src]

impl<T: Data> Pull<Message<T>> for PullerInner<T>[src]

impl<T> Deref for Message<T>[src]

type Target = T

The resulting type after dereferencing.

Auto Trait Implementations

impl<T> Send for Message<T> where
    T: Send + Sync

impl<T> !Sync for Message<T>

impl<T> Unpin for Message<T> where
    T: Unpin

impl<T> !UnwindSafe for Message<T>

impl<T> !RefUnwindSafe for Message<T>

Blanket Implementations

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]