pub struct Envelope<'a> {
pub token: Token,
pub cursor: Option<&'a [u8]>,
pub remaining: Option<u32>,
pub frame: &'a [u8],
}Expand description
A parsed envelope borrowing from the payload it was read out of.
Fields§
§token: Token§cursor: Option<&'a [u8]>The cursor to present in the next request, in a response; the position being continued, in a request.
remaining: Option<u32>Advisory count of octets not yet returned.
frame: &'a [u8]Exactly one ULCP frame, unparsed.
Implementations§
Source§impl<'a> Envelope<'a>
impl<'a> Envelope<'a>
Sourcepub const fn new(token: Token, frame: &'a [u8]) -> Self
pub const fn new(token: Token, frame: &'a [u8]) -> Self
A bare envelope carrying frame and nothing else.
pub const fn with_cursor(self, cursor: &'a [u8]) -> Self
pub const fn with_remaining(self, remaining: u32) -> Self
Sourcepub fn parse(payload: &'a [u8]) -> Result<Self, EnvelopeError>
pub fn parse(payload: &'a [u8]) -> Result<Self, EnvelopeError>
Read an envelope out of a payload, the payload type byte already stripped.
Trait Implementations§
impl<'a> Copy for Envelope<'a>
impl<'a> Eq for Envelope<'a>
impl<'a> StructuralPartialEq for Envelope<'a>
Auto Trait Implementations§
impl<'a> Freeze for Envelope<'a>
impl<'a> RefUnwindSafe for Envelope<'a>
impl<'a> Send for Envelope<'a>
impl<'a> Sync for Envelope<'a>
impl<'a> Unpin for Envelope<'a>
impl<'a> UnwindSafe for Envelope<'a>
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)