pub struct Frame<'a> { /* private fields */ }Expand description
Exactly one validated value node, borrowed.
A frame of plaintext is plaintext, so Debug is redacted and == is
constant time.
Implementations§
Source§impl<'a> Frame<'a>
impl<'a> Frame<'a>
Sourcepub fn parse(bytes: &'a [u8]) -> Result<Self, FrameError>
pub fn parse(bytes: &'a [u8]) -> Result<Self, FrameError>
Validate bytes as exactly one value node.
The whole frame is checked up front, so visit
never has to report a malformed frame part way through a walk.
Sourcepub fn parse_nested(
bytes: &'a [u8],
depth: usize,
) -> Result<(Self, &'a [u8]), FrameError>
pub fn parse_nested( bytes: &'a [u8], depth: usize, ) -> Result<(Self, &'a [u8]), FrameError>
Validate the value node at the start of bytes, and return it with
the bytes after it.
For a frame embedded in a larger structure, such as the passthrough
payload of a ciphertext node. depth is how many levels the carrier
already nests the node, so the MAX_DEPTH bound counts the whole
structure and not the frame alone.
pub fn as_bytes(&self) -> &'a [u8] ⓘ
Trait Implementations§
impl<'a> Copy for Frame<'a>
Source§impl Encrypt for Frame<'_>
A frame walked in place: no scalar leaves the buffer except to go
straight to the sink.
impl Encrypt for Frame<'_>
A frame walked in place: no scalar leaves the buffer except to go straight to the sink.
Source§fn visit<S: Sink>(self, sink: S) -> Result<S::Ok, S::Error>
fn visit<S: Sink>(self, sink: S) -> Result<S::Ok, S::Error>
Describe
self to sink, consuming it.Source§const FIXED: Option<FixedType> = None
const FIXED: Option<FixedType> = None
The fixed-width scalar type every value of this type has, if it has
one: an int, a float, a date, a timestamp, a decimal.
None, the
default, for everything else: a bool (whose leaf is already as short
as a null’s), text, bytes, a container, a value whose type depends
on the value. Read moreSource§impl Encrypt for &Frame<'_>
A borrowed frame is the same frame: it is a view, and Copy.
impl Encrypt for &Frame<'_>
A borrowed frame is the same frame: it is a view, and Copy.
Source§fn visit<S: Sink>(self, sink: S) -> Result<S::Ok, S::Error>
fn visit<S: Sink>(self, sink: S) -> Result<S::Ok, S::Error>
Describe
self to sink, consuming it.Source§const FIXED: Option<FixedType> = None
const FIXED: Option<FixedType> = None
The fixed-width scalar type every value of this type has, if it has
one: an int, a float, a date, a timestamp, a decimal.
None, the
default, for everything else: a bool (whose leaf is already as short
as a null’s), text, bytes, a container, a value whose type depends
on the value. Read moreimpl<'a> Eq for Frame<'a>where
&'a [u8]: TimingSafeEq,
impl<'a> OpaqueDebug for Frame<'a>
Auto Trait Implementations§
impl<'a> Freeze for Frame<'a>
impl<'a> RefUnwindSafe for Frame<'a>
impl<'a> Send for Frame<'a>
impl<'a> Sync for Frame<'a>
impl<'a> Unpin for Frame<'a>
impl<'a> UnsafeUnpin for Frame<'a>
impl<'a> UnwindSafe for Frame<'a>
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