Skip to main content

BlackBoxProcessor

Struct BlackBoxProcessor 

Source
pub struct BlackBoxProcessor { /* private fields */ }
Expand description

True DOMless processor with schema-based filtering

Implementations§

Source§

impl BlackBoxProcessor

Source

pub fn new( input_schema: Vec<String>, output_schema: Vec<String>, ) -> BlackBoxProcessor

Create a new DOMless processor with adaptive processing

Source

pub fn new_unfiltered() -> BlackBoxProcessor

Create a processor without schema filtering (legacy mode)

Source

pub fn process(&mut self, input: &str) -> Result<String, DsonError>

Process input JSON through DOMless filtering and operations

§Errors

Returns an error if JSON parsing fails or processing encounters an issue

Source

pub fn apply_operations( &mut self, operations: &[DsonOperation], ) -> Result<(), DsonError>

Apply a sequence of operations to the processor

§Errors

Returns an error if any operation fails

Source

pub fn apply_operations_canonical( &mut self, operations: &[DsonOperation], ) -> Result<(), DsonError>

Apply operations with canonical optimization and batching

§Errors

Returns an error if canonical processing or operation application fails

Source

pub fn process_with_operations( &mut self, input: &str, operations: &[DsonOperation], ) -> Result<String, DsonError>

Process input with a specific set of operations

§Errors

Returns an error if parsing or processing fails

Source

pub fn process_with_operations_canonical( &mut self, input: &str, operations: &[DsonOperation], ) -> Result<String, DsonError>

Process input with operations using canonical optimization

§Errors

Returns an error if parsing or processing fails

Source

pub fn read_field( &self, field_path: &str, ) -> Result<Option<Node<'static>>, DsonError>

Read a field from the tape at given path

§Errors

Returns an error if field navigation fails

Source

pub fn read_field_value( &self, field_path: &str, ) -> Result<Option<OperationValue>, DsonError>

Read a field value directly as OperationValue (avoids Node conversion overhead)

This is the fast path for reading values - converts tape Node directly to OperationValue

§Errors

Returns an error if field navigation fails.

Source

pub fn write_field( &mut self, field_path: &str, value: Node<'static>, ) -> Result<(), DsonError>

Write a field to the tape (tracks as modification for later serialization)

§Errors

Returns an error if field modification fails

Source

pub fn advance_field(&self) -> Result<bool, DsonError>

Advance to next field in object - returns true if more fields exist

§Errors

Returns an error if navigation fails

Source

pub fn push_record(&mut self, record: Node<'static>) -> Result<(), DsonError>

Push a new record to array (tracks for later serialization)

§Errors

Returns an error if record addition fails

Source

pub fn advance_array_index(&self) -> Result<bool, DsonError>

Advance to next array index - returns true if more elements exist

§Errors

Returns an error if navigation fails

Source

pub fn input_schema(&self) -> Vec<String>

Get input schema paths

Source

pub fn output_schema(&self) -> Vec<String>

Get output schema paths

Source

pub fn apply_operation( &mut self, operation: &DsonOperation, ) -> Result<(), DsonError>

Apply a DSON operation to the processor

§Errors

Returns an error if the operation cannot be applied

Source

pub fn generate_output(&self) -> Result<String, DsonError>

Generate final JSON output based on modifications and deletions

§Errors

Returns an error if output generation fails.

Source

pub const fn modifications(&self) -> &AHashMap<String, OperationValue>

Get the current modifications map (for inspection)

Source

pub const fn deletions(&self) -> &AHashSet<String>

Get the current deletions set (for inspection)

Source

pub const fn determine_processing_mode( &self, document_size: usize, operation_count: usize, ) -> ProcessingMode

Determine optimal processing mode based on document and operation characteristics

Source

pub fn process_adaptive( &mut self, input: &str, operations: &[DsonOperation], ) -> Result<String, DsonError>

Process with adaptive mode selection

§Errors

Returns an error if processing fails

Source

pub fn apply_operation_to_value_cached( &mut self, value: &mut Value, operation: &DsonOperation, ) -> Result<(), DsonError>

Apply operation directly to serde_json::Value using cached parsed paths.

§Errors

Returns an error if the operation cannot be applied

Source

pub fn apply_operation_to_value_parsed( &mut self, value: &mut Value, operation: &DsonOperation, parsed: &ParsedPath, ) -> Result<(), DsonError>

Apply operation directly to serde_json::Value using a pre-parsed path.

§Errors

Returns an error if the operation cannot be applied

Trait Implementations§

Source§

impl Default for BlackBoxProcessor

Source§

fn default() -> BlackBoxProcessor

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

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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
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.