Module lazy

Source
Expand description

Lazy value, uses a tape until mutated.

If it is mutated it is upgraded to a borrowed value. This allows for cheap parsing and data access while still maintaining mutability.

§Example

use simd_json::{prelude::*, value::lazy::Value};

let mut json = br#"{"key": "value", "snot": 42}"#.to_vec();
let tape = simd_json::to_tape( json.as_mut_slice()).unwrap();
let value = tape.as_value();
let mut lazy = Value::from_tape(value);

assert_eq!(lazy.get("key").unwrap(), "value");

assert!(lazy.is_tape());
lazy.insert("new", 42);
assert!(lazy.is_value());
assert_eq!(lazy.get("key").unwrap(), "value");
assert_eq!(lazy.get("new").unwrap(), 42);

Modules§

array
Lazy implemntation of the array trait and associated functionality
object
Lazy implementation of the object trait and associated functionality

Enums§

Array
Wrapper around the tape that allows interacting with it via a Array-like API.
Object
Wrapper around the tape that allows interacting with it via a Object-like API.
Value
A lazy value, this gets initialized with a tape and as long as only non mutating operations are performed it will stay a tape. If a mutating operation is performed it will upgrade to a borrowed value.