Skip to main content

Frame

Struct Frame 

Source
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>

Source

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.

Source

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.

Source

pub fn as_bytes(&self) -> &'a [u8] ⓘ

Trait Implementations§

Source§

impl<'a> Clone for Frame<'a>

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<'a> Copy for Frame<'a>

Source§

impl<'a> Debug for Frame<'a>

Source§

fn fmt(&self, __opaque_debug_f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

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>

Describe self to sink, consuming it.
Source§

const DEPTH: Option<usize> = None

How deep a value of this type can nest below its own root, when the type alone fixes it: Some(0) for a scalar, one more than its deepest child for a sequence or map (see depth). None, the default, when it depends on the value: a recursive type, a frame, a live host value. Read more
Source§

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 more
Source§

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>

Describe self to sink, consuming it.
Source§

const DEPTH: Option<usize> = None

How deep a value of this type can nest below its own root, when the type alone fixes it: Some(0) for a scalar, one more than its deepest child for a sequence or map (see depth). None, the default, when it depends on the value: a recursive type, a frame, a live host value. Read more
Source§

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 more
Source§

impl<'a> Eq for Frame<'a>
where &'a [u8]: TimingSafeEq,

Source§

impl<'a> OpaqueDebug for Frame<'a>

Source§

impl<'a> PartialEq for Frame<'a>
where &'a [u8]: TimingSafeEq,

Source§

fn eq(&self, __ts_other: &Self) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl<'a> TimingSafeEq for Frame<'a>
where &'a [u8]: TimingSafeEq,

Source§

fn ts_eq(&self, __ts_other: &Self) -> Choice

Must be constant-time with respect to secret data.
Source§

fn ts_ne(&self, other: &Self) -> Choice

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.