pub struct Frame {
pub header: EnvelopeHeader,
pub body: Vec<u8>,
}Expand description
A complete wire frame: the decoded envelope header plus its opaque body.
Fields§
§header: EnvelopeHeader§body: Vec<u8>Implementations§
Source§impl Frame
impl Frame
Sourcepub fn build(
ty: FrameType,
flags: Flags,
channel: u16,
corr: u64,
body: Vec<u8>,
) -> Result<Self, FrameBuildError>
pub fn build( ty: FrameType, flags: Flags, channel: u16, corr: u64, body: Vec<u8>, ) -> Result<Self, FrameBuildError>
Build a v1 frame, filling len from the opaque body bytes.
Sourcepub fn build_with_version(
ver: u8,
ty: FrameType,
flags: Flags,
channel: u16,
corr: u64,
body: Vec<u8>,
) -> Result<Self, FrameBuildError>
pub fn build_with_version( ver: u8, ty: FrameType, flags: Flags, channel: u16, corr: u64, body: Vec<u8>, ) -> Result<Self, FrameBuildError>
Build a frame for an already-negotiated envelope version, filling len
from the opaque body bytes.
Sourcepub fn from_wire(header: EnvelopeHeader, body: Vec<u8>) -> Self
pub fn from_wire(header: EnvelopeHeader, body: Vec<u8>) -> Self
Assemble a frame from an already-decoded header and its body bytes.
Callers must ensure header.len == body.len(); frame readers obtain the
body by reading exactly header.len bytes, so this holds by construction.
Trait Implementations§
impl Eq for Frame
impl StructuralPartialEq for Frame
Auto Trait Implementations§
impl Freeze for Frame
impl RefUnwindSafe for Frame
impl Send for Frame
impl Sync for Frame
impl Unpin for Frame
impl UnsafeUnpin for Frame
impl UnwindSafe for Frame
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