// Add a new row to the FlatJson representation.
//
// self.pretty_printed should NOT include the added row yet;
// we use the current length of self.pretty_printed as the
// starting index of the row's range.
Add a new row to the FlatJson representation.
self.pretty_printed should NOT include the added row yet;
we use the current length of self.pretty_printed as the
starting index of the row's range.
Add a new row to the FlatJson representation . self . pretty_printed should NOT include the added row yet ; we use the current length of self . pretty_printed as the starting index of the row ' s range .
fn create_row(&mut self, value: Value) -> usize {
        let index = self.rows.len();
        let parent = match self.parents.last() {
            None => OptionIndex::Nil,
            Some(row_index) => OptionIndex::Index(*row_index),
        };
        let range_start = self.pretty_printed.len();
        self.rows.push(Row {
            // Set correctly by us
            parent,
            depth: self.parents.len(),
            value,
            // The start of this range is set by us, but then we set
            // the end when we're done parsing the row. We'll set
            // the default end to be one character so we don't have to
            // update it after ']' and '}'.
            range: range_start..range_start + 1,
            // To be filled in by caller
            prev_sibling: OptionIndex::Nil,
            next_sibling: OptionIndex::Nil,
            index: 0,
            key_range: None,
        });
        index
    }
fn create_row ( & mut self , value : Value ) -> usize { let index = self . rows . len ( ) ; let parent = match self . parents . last ( ) { None => OptionIndex :: Nil , Some ( row_index ) => OptionIndex :: Index ( * row_index ) , } ; let range_start = self . pretty_printed . len ( ) ; self . rows . push ( Row { // Set correctly by us parent , depth : self . parents . len ( ) , value , // The start of this range is set by us, but then we set // the end when we're done parsing the row. We'll set // the default end to be one character so we don't have to // update it after ']' and '}'. range : range_start .. range_start + 1 , // To be filled in by caller prev_sibling : OptionIndex :: Nil , next_sibling : OptionIndex :: Nil , index : 0 , key_range : None , } ) ; index }
Add a new row to the FlatJson representation.
Add a new row to the FlatJson representation .
&mut self
value
Value