Skip to main content

PlanBuilder

Struct PlanBuilder 

Source
pub struct PlanBuilder<'a> { /* private fields */ }
Expand description

Fallible, bounded assembly shared by codec-specific rewrite planners.

Implementations§

Source§

impl<'a> PlanBuilder<'a>

Source

pub fn new() -> Self

Start an empty plan; each carrier operation checks its request budget.

Source

pub fn record( &mut self, req: &Context<'a>, range: Range<usize>, carrier: &'static str, action: Action, bytes: Option<Cow<'a, [u8]>>, ) -> Result<(), Error>

Record one input carrier and an optional output chunk, enforcing budgets.

Source

pub fn keep( &mut self, req: &Context<'a>, range: Range<usize>, name: &'static str, ) -> Result<(), Error>

Retain a validated range from the encoded input.

Source

pub fn remove( &mut self, req: &Context<'a>, range: Range<usize>, name: &'static str, ) -> Result<(), Error>

Record a removed input carrier.

Source

pub fn output_len(&self) -> usize

Current encoded output size.

Source

pub fn inject_after_first( &mut self, req: &Context<'a>, bytes: Vec<u8>, name: &'static str, ) -> Result<(), Error>

Insert a generated carrier immediately after the first output chunk.

Source

pub fn remove_kept_range( &mut self, req: &Context<'a>, range: &Range<usize>, ) -> Result<(), Error>

Remove a previously retained carrier before inserting its replacement.

Source

pub fn append( &mut self, req: &Context<'a>, other: Self, offset: usize, ) -> Result<(), Error>

Append a contained-image plan, translating its report to parent offsets.

Source

pub fn finish(self) -> Result<Plan<'a>, Error>

Finish with the stable zencodec-owned plan type.

Trait Implementations§

Source§

impl<'a> Debug for PlanBuilder<'a>

Source§

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

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

impl<'a> Default for PlanBuilder<'a>

Source§

fn default() -> PlanBuilder<'a>

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for PlanBuilder<'a>

§

impl<'a> RefUnwindSafe for PlanBuilder<'a>

§

impl<'a> Send for PlanBuilder<'a>

§

impl<'a> Sync for PlanBuilder<'a>

§

impl<'a> Unpin for PlanBuilder<'a>

§

impl<'a> UnsafeUnpin for PlanBuilder<'a>

§

impl<'a> UnwindSafe for PlanBuilder<'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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

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

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

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.