[−][src]Struct timely_communication::message::Message
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]
fn push(&mut self, element: &mut Option<Message<T>>)
[src]
fn send(&mut self, element: T)
[src]
Pushes element
and drops any resulting resources.
fn done(&mut self)
[src]
Pushes None
, conventionally signalling a flush.
impl<T: Data> Pull<Message<T>> for Puller<T>
[src]
fn pull(&mut self) -> &mut Option<Message<T>>
[src]
fn recv(&mut self) -> Option<T>
[src]
Takes an Option<T>
and leaves None
behind.
impl<T: Data> Pull<Message<T>> for PullerInner<T>
[src]
fn pull(&mut self) -> &mut Option<Message<T>>
[src]
fn recv(&mut self) -> Option<T>
[src]
Takes an Option<T>
and leaves None
behind.
impl<T> Deref for Message<T>
[src]
Auto Trait Implementations
impl<T> !Sync for Message<T>
impl<T> Unpin for Message<T> where
T: Unpin,
T: Unpin,
impl<T> Send for Message<T> where
T: Send + Sync,
T: Send + Sync,
impl<T> !UnwindSafe for Message<T>
impl<T> !RefUnwindSafe for Message<T>
Blanket Implementations
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,