Skip to main content

TapeVisitor

Trait TapeVisitor 

Source
pub trait TapeVisitor<'a> {
    type Output;

    // Required methods
    fn visit_null(&mut self) -> Result<Self::Output>;
    fn visit_bool(&mut self, v: bool) -> Result<Self::Output>;
    fn visit_i64(&mut self, v: i64) -> Result<Self::Output>;
    fn visit_u64(&mut self, v: u64) -> Result<Self::Output>;
    fn visit_f64(&mut self, v: f64) -> Result<Self::Output>;
    fn visit_str(&mut self, s: &'a str) -> Result<Self::Output>;
    fn visit_array(
        &mut self,
        tape: &mut TapeRef<'a>,
        end_idx: usize,
    ) -> Result<Self::Output>;
    fn visit_object(
        &mut self,
        tape: &mut TapeRef<'a>,
        end_idx: usize,
    ) -> Result<Self::Output>;
}
Expand description

Callback-based visitor interface for the simdjson tape.

Implement this trait to build custom data structures from the tape without allocating intermediate Value nodes.

Required Associated Types§

Source

type Output

The value produced after visiting a complete JSON value.

Required Methods§

Source

fn visit_null(&mut self) -> Result<Self::Output>

Source

fn visit_bool(&mut self, v: bool) -> Result<Self::Output>

Source

fn visit_i64(&mut self, v: i64) -> Result<Self::Output>

Source

fn visit_u64(&mut self, v: u64) -> Result<Self::Output>

Source

fn visit_f64(&mut self, v: f64) -> Result<Self::Output>

Source

fn visit_str(&mut self, s: &'a str) -> Result<Self::Output>

Visit a string value. The s borrow is tied to the tape lifetime 'a.

Source

fn visit_array( &mut self, tape: &mut TapeRef<'a>, end_idx: usize, ) -> Result<Self::Output>

Visit an array. The implementor should call tape.visit(self) for each element while tape.pos() < end_idx.

Source

fn visit_object( &mut self, tape: &mut TapeRef<'a>, end_idx: usize, ) -> Result<Self::Output>

Visit an object. Fields are key–value pairs; the implementor should read key strings and call tape.visit(self) for values while tape.pos() < end_idx.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§