pub struct BlackBoxProcessor { /* private fields */ }Expand description
True DOMless processor with schema-based filtering
Implementations§
Source§impl BlackBoxProcessor
impl BlackBoxProcessor
Sourcepub fn new(
input_schema: Vec<String>,
output_schema: Vec<String>,
) -> BlackBoxProcessor
pub fn new( input_schema: Vec<String>, output_schema: Vec<String>, ) -> BlackBoxProcessor
Create a new DOMless processor with adaptive processing
Sourcepub fn new_unfiltered() -> BlackBoxProcessor
pub fn new_unfiltered() -> BlackBoxProcessor
Create a processor without schema filtering (legacy mode)
Sourcepub fn process(&mut self, input: &str) -> Result<String, DsonError>
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
Sourcepub fn apply_operations(
&mut self,
operations: &[DsonOperation],
) -> Result<(), DsonError>
pub fn apply_operations( &mut self, operations: &[DsonOperation], ) -> Result<(), DsonError>
Sourcepub fn apply_operations_canonical(
&mut self,
operations: &[DsonOperation],
) -> Result<(), DsonError>
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
Sourcepub fn process_with_operations(
&mut self,
input: &str,
operations: &[DsonOperation],
) -> Result<String, DsonError>
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
Sourcepub fn process_with_operations_canonical(
&mut self,
input: &str,
operations: &[DsonOperation],
) -> Result<String, DsonError>
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
Sourcepub fn read_field_value(
&self,
field_path: &str,
) -> Result<Option<OperationValue>, DsonError>
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.
Sourcepub fn write_field(
&mut self,
field_path: &str,
value: Node<'static>,
) -> Result<(), DsonError>
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
Sourcepub fn advance_field(&self) -> Result<bool, DsonError>
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
Sourcepub fn push_record(&mut self, record: Node<'static>) -> Result<(), DsonError>
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
Sourcepub fn advance_array_index(&self) -> Result<bool, DsonError>
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
Sourcepub fn input_schema(&self) -> Vec<String>
pub fn input_schema(&self) -> Vec<String>
Get input schema paths
Sourcepub fn output_schema(&self) -> Vec<String>
pub fn output_schema(&self) -> Vec<String>
Get output schema paths
Sourcepub fn apply_operation(
&mut self,
operation: &DsonOperation,
) -> Result<(), DsonError>
pub fn apply_operation( &mut self, operation: &DsonOperation, ) -> Result<(), DsonError>
Sourcepub fn generate_output(&self) -> Result<String, DsonError>
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.
Sourcepub const fn modifications(&self) -> &AHashMap<String, OperationValue>
pub const fn modifications(&self) -> &AHashMap<String, OperationValue>
Get the current modifications map (for inspection)
Sourcepub const fn deletions(&self) -> &AHashSet<String>
pub const fn deletions(&self) -> &AHashSet<String>
Get the current deletions set (for inspection)
Sourcepub const fn determine_processing_mode(
&self,
document_size: usize,
operation_count: usize,
) -> ProcessingMode
pub const fn determine_processing_mode( &self, document_size: usize, operation_count: usize, ) -> ProcessingMode
Determine optimal processing mode based on document and operation characteristics
Sourcepub fn process_adaptive(
&mut self,
input: &str,
operations: &[DsonOperation],
) -> Result<String, DsonError>
pub fn process_adaptive( &mut self, input: &str, operations: &[DsonOperation], ) -> Result<String, DsonError>
Sourcepub fn apply_operation_to_value_cached(
&mut self,
value: &mut Value,
operation: &DsonOperation,
) -> Result<(), DsonError>
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
Sourcepub fn apply_operation_to_value_parsed(
&mut self,
value: &mut Value,
operation: &DsonOperation,
parsed: &ParsedPath,
) -> Result<(), DsonError>
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
impl Default for BlackBoxProcessor
Source§fn default() -> BlackBoxProcessor
fn default() -> BlackBoxProcessor
Auto Trait Implementations§
impl Freeze for BlackBoxProcessor
impl !RefUnwindSafe for BlackBoxProcessor
impl Send for BlackBoxProcessor
impl Sync for BlackBoxProcessor
impl Unpin for BlackBoxProcessor
impl UnwindSafe for BlackBoxProcessor
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
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 moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
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