Skip to main content

EncodeContext

Struct EncodeContext 

Source
pub struct EncodeContext<'a, Value, Unit> {
    pub input_value: &'a Value,
    pub input_index: usize,
    pub output: &'a mut [Unit],
    pub output_index: usize,
}
Expand description

Context for one encode attempt inside a buffered encoder engine.

The context carries the current input value and output cursor. It does not contain the prepared crate::EncodePlan; the engine keeps planning separate so callers and hooks can distinguish cursor state from policy state.

§Type Parameters

  • Value: Logical input value type.
  • Unit: Encoded output unit type.

Fields§

§input_value: &'a Value

Input value being encoded.

§input_index: usize

Absolute input index of input_value.

§output: &'a mut [Unit]

Complete output unit slice visible to the encoder.

§output_index: usize

Start position in output where writing begins.

Implementations§

Source§

impl<Value, Unit> EncodeContext<'_, Value, Unit>

Source

pub fn available_output(&self) -> usize

Returns writable output units from the current output index.

§Returns

Returns output capacity visible to this encode step.

Trait Implementations§

Source§

impl<'a, Value: Debug, Unit: Debug> Debug for EncodeContext<'a, Value, Unit>

Source§

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

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, Value, Unit> !UnwindSafe for EncodeContext<'a, Value, Unit>

§

impl<'a, Value, Unit> Freeze for EncodeContext<'a, Value, Unit>

§

impl<'a, Value, Unit> RefUnwindSafe for EncodeContext<'a, Value, Unit>
where Value: RefUnwindSafe, Unit: RefUnwindSafe,

§

impl<'a, Value, Unit> Send for EncodeContext<'a, Value, Unit>
where Value: Sync, Unit: Send,

§

impl<'a, Value, Unit> Sync for EncodeContext<'a, Value, Unit>
where Value: Sync, Unit: Sync,

§

impl<'a, Value, Unit> Unpin for EncodeContext<'a, Value, Unit>

§

impl<'a, Value, Unit> UnsafeUnpin for EncodeContext<'a, Value, Unit>

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.