pub struct Message<T> { /* private fields */ }
Expand description
A wrapped message which may be either typed or binary data.
Implementations§
Source§impl<T> Message<T>
impl<T> Message<T>
Sourcepub fn from_typed(typed: T) -> Message<T>
pub fn from_typed(typed: T) -> Message<T>
Wrap a typed item as a message.
Sourcepub fn as_ref_or_mut(&mut self) -> RefOrMut<'_, T>
pub fn as_ref_or_mut(&mut self) -> RefOrMut<'_, T>
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.
Source§impl<T> Message<T>where
T: Data,
impl<T> Message<T>where
T: Data,
Sourcepub unsafe fn from_bytes(bytes: Bytes) -> Message<T>
pub unsafe fn from_bytes(bytes: Bytes) -> Message<T>
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).
Sourcepub fn length_in_bytes(&self) -> usize
pub fn length_in_bytes(&self) -> usize
The number of bytes required to serialize the data.
Sourcepub fn into_bytes<W>(&self, writer: &mut W)where
W: Write,
pub fn into_bytes<W>(&self, writer: &mut W)where
W: Write,
Writes the binary representation into writer
.
Trait Implementations§
Source§impl<T, D: Container, P: Pull<BundleCore<T, D>>> Pull<Message<Message<T, D>>> for LogPuller<T, D, P>
impl<T, D: Container, P: Pull<BundleCore<T, D>>> Pull<Message<Message<T, D>>> for LogPuller<T, D, P>
Source§impl<T: Eq + Data, C, D: Data, P: Push<BundleCore<T, C>>, H: FnMut(&D) -> u64> Push<Message<Message<T, C>>> for Exchange<T, C, D, P, H>where
C: PushPartitioned<Item = D> + Container,
impl<T: Eq + Data, C, D: Data, P: Push<BundleCore<T, C>>, H: FnMut(&D) -> u64> Push<Message<Message<T, C>>> for Exchange<T, C, D, P, H>where
C: PushPartitioned<Item = D> + Container,
Source§impl<T: Timestamp, D: Container, P> Push<Message<Message<T, D>>> for CounterCore<T, D, P>where
P: Push<BundleCore<T, D>>,
impl<T: Timestamp, D: Container, P> Push<Message<Message<T, D>>> for CounterCore<T, D, P>where
P: Push<BundleCore<T, D>>,
Source§impl<T, D: Container, P: Push<BundleCore<T, D>>> Push<Message<Message<T, D>>> for LogPusher<T, D, P>
impl<T, D: Container, P: Push<BundleCore<T, D>>> Push<Message<Message<T, D>>> for LogPusher<T, D, P>
Auto Trait Implementations§
impl<T> Freeze for Message<T>where
T: Freeze,
impl<T> !RefUnwindSafe for Message<T>
impl<T> Send for Message<T>
impl<T> !Sync for Message<T>
impl<T> Unpin for Message<T>where
T: Unpin,
impl<T> !UnwindSafe for Message<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more