[][src]Struct arya::JsonBuilder

pub struct JsonBuilder { /* fields omitted */ }

a string builder for json that can repair and complete incomplete ("damaged") json.

remarks

unlike the JsonVerifier, adding a sequence of characters that would make the underlying json object invalid will cause the JsonBuilder to remain invalid, even if more characters are added to it later.

examples

let mut builder = JsonBuilder::new();

builder.update(r#"{
    "name": "annie",
    "age": 14,
    "parents": {
        "mother": null,
        "bro
"#);

builder.update("ken");

builder.completed_string();
// => Ok({
// =>     "name": "annie",
// =>     "age": 14,
// =>     "nested": {
// =>         "mother": null
// =>     }
// => })

Methods

impl JsonBuilder[src]

pub fn new() -> JsonBuilder[src]

pub fn with_maximum_depth(maximum_depth: usize) -> JsonBuilder[src]

pub fn with_capacity(initial_capacity: usize) -> JsonBuilder[src]

pub fn with_options(options: JsonBuilderOptions) -> JsonBuilder[src]

pub fn len(&self) -> usize[src]

pub fn status(&self) -> JsonStatus[src]

pub fn reset(&mut self)[src]

pub fn update(&mut self, source: impl JsonSource) -> Result<(), JsonError>[src]

pub fn bytes(self) -> Result<Vec<u8>, JsonError>[src]

pub fn string(self) -> Result<String, JsonError>[src]

pub fn completed_bytes(self) -> Result<Vec<u8>, JsonError>[src]

pub fn completed_string(self) -> Result<String, JsonError>[src]

Auto Trait Implementations

impl Send for JsonBuilder

impl Sync for JsonBuilder

Blanket Implementations

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T> From for T[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]