Struct wire_framed::Message
source · pub struct Message { /* private fields */ }Expand description
A message with frames.
Frame
A frame consists of the length of the blob and the blob itself.
| blob length | blob |
Message
A message consists of (potentially) many frames. After a frame, a special byte exists to denote if the message has more frames to read. The byte contains 0 if it has no more frames and 1 if it has.
| frame | frame end byte |
Implementations§
source§impl Message
impl Message
sourcepub fn from_frames(frames: impl Into<VecDeque<Bytes, Global>>) -> Message
pub fn from_frames(frames: impl Into<VecDeque<Bytes, Global>>) -> Message
Constructs a Message from an iterator of [Frame]s.
sourcepub fn builder() -> MessageBuilder
pub fn builder() -> MessageBuilder
Constructs a MessageBuilder.
sourcepub fn extend(&mut self, frames: impl IntoIterator<Item = Bytes>)
pub fn extend(&mut self, frames: impl IntoIterator<Item = Bytes>)
Extends a collection with the contents of an iterator.
sourcepub fn push_message(&mut self, msg: Message)
pub fn push_message(&mut self, msg: Message)
Push a message into the message.
sourcepub fn frame_count(&self) -> usize
pub fn frame_count(&self) -> usize
Returns the number of frames in the message.
sourcepub fn byte_count(&self) -> usize
pub fn byte_count(&self) -> usize
Returns the total length of the message in bytes.
Trait Implementations§
source§impl Encoder<Message> for MessageCodec
impl Encoder<Message> for MessageCodec
source§impl PartialEq<Message> for Message
impl PartialEq<Message> for Message
impl Eq for Message
impl StructuralEq for Message
impl StructuralPartialEq for Message
Auto Trait Implementations§
impl RefUnwindSafe for Message
impl Send for Message
impl Sync for Message
impl Unpin for Message
impl UnwindSafe for Message
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