Struct ReducedAllocComposer

Source
pub struct ReducedAllocComposer {
    parser: BasicParser,
    position: Position,
    anchors: HashMap<String, Rc<OptimizedValue>>,
    limits: Limits,
    resource_tracker: ResourceTracker,
    alias_expansion_stack: Vec<String>,
    current_depth: usize,
}
Expand description

An optimized composer that reduces allocations

Fields§

§parser: BasicParser§position: Position§anchors: HashMap<String, Rc<OptimizedValue>>

Store anchors using Rc for cheap cloning

§limits: Limits§resource_tracker: ResourceTracker§alias_expansion_stack: Vec<String>§current_depth: usize

Implementations§

Source§

impl ReducedAllocComposer

Source

pub fn new(input: String) -> Self

Create a new optimized composer

Source

pub fn with_limits(input: String, limits: Limits) -> Self

Create a new optimized composer with custom limits

Source

fn compose_node(&mut self) -> Result<Option<OptimizedValue>>

Compose a node from events with reduced allocations

Source

fn compose_scalar_optimized( &self, value: String, style: ScalarStyle, ) -> Result<OptimizedValue>

Compose a scalar value with optimization

Source

fn compose_sequence(&mut self) -> Result<Option<OptimizedValue>>

Compose a sequence with reduced allocations

Source

fn compose_mapping(&mut self) -> Result<Option<OptimizedValue>>

Compose a mapping with reduced allocations

Source

fn process_merge_key( &self, mapping: &mut IndexMap<OptimizedValue, OptimizedValue>, merge_value: &OptimizedValue, ) -> Result<()>

Process a merge key by merging values into the current mapping

Trait Implementations§

Source§

impl OptimizedComposer for ReducedAllocComposer

Source§

fn check_document(&self) -> bool

Check if there are more documents available
Source§

fn compose_document(&mut self) -> Result<Option<OptimizedValue>>

Compose the next document with minimal allocations
Source§

fn position(&self) -> Position

Get the current position in the stream
Source§

fn reset(&mut self)

Reset the composer state

Auto Trait Implementations§

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.