[−][src]Struct arya::JsonBuilder
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]
U: From<T>,
impl<T> From for T
[src]
impl<T, U> TryFrom for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T> Borrow for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T, U> TryInto for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,