Skip to main content

FrameWriter

Struct FrameWriter 

Source
pub struct FrameWriter<'o> { /* private fields */ }
Expand description

A sink that writes one value node onto the end of a buffer. Unknown container lengths are patched in at end.

Implementations§

Source§

impl<'o> FrameWriter<'o>

Source

pub fn new(out: &'o mut Vec<u8>) -> Self

Source

pub fn at_depth(out: &'o mut Vec<u8>, depth: usize) -> Self

A writer for a node that sits depth levels below the top of a document, so MAX_DEPTH counts from the top: for a subtree written to a buffer of its own and copied into the document later.

Source

pub fn depth(&self) -> usize

How many levels below the top of its document this writer’s node sits.

Trait Implementations§

Source§

impl<'o> Sink for FrameWriter<'o>

Source§

fn typed_null(self, _: FixedType) -> Result<(), FrameWriteError>

Written as the plain null. A frame is plaintext, never sealed, so padding hides nothing in it: what a frame writer produces goes to a host (the frame decrypt_to_frame returns) or into the clear (a passthrough subtree), where the plain null is what every reader already knows. A frame a host sends may still carry a typed null, which Frame reads, so the host’s absent values are padded when sealed.

Source§

type Ok = ()

What the sink produces when the walk ends.
Source§

type Error = FrameWriteError

The sink’s error, which can also carry a SourceError.
Source§

type Seq = FrameSeq<'o>

The sink for a sequence’s elements.
Source§

type Map = FrameMap<'o>

The sink for a map’s entries.
Source§

fn scalar( self, ty: Option<Logical>, v: Physical<'_>, ) -> Result<(), FrameWriteError>

One scalar: a physical value, and the logical type it represents, if any. See kinds. Read more
Source§

fn seq(self, len: Option<usize>) -> Result<FrameSeq<'o>, FrameWriteError>

Start a sequence. len is a hint; a source that does not know its length passes None.
Source§

fn map(self, len: Option<usize>) -> Result<FrameMap<'o>, FrameWriteError>

Start a map with string keys. len is a hint.
Source§

fn passthrough<P: Encrypt + Clone>( self, value: P, ) -> Result<(), FrameWriteError>

A subtree that travels in the clear. It is walked like anything else; the sink decides what “in the clear” means for it. Read more

Auto Trait Implementations§

§

impl<'o> !UnwindSafe for FrameWriter<'o>

§

impl<'o> Freeze for FrameWriter<'o>

§

impl<'o> RefUnwindSafe for FrameWriter<'o>

§

impl<'o> Send for FrameWriter<'o>

§

impl<'o> Sync for FrameWriter<'o>

§

impl<'o> Unpin for FrameWriter<'o>

§

impl<'o> UnsafeUnpin for FrameWriter<'o>

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> 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, 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.