pub struct ArrayBuilder {
pub array: JsonArray,
pub null: bool,
pub skip: bool,
pub root: Option<String>,
}
Fields§
§array: JsonArray
§null: bool
§skip: bool
§root: Option<String>
Implementations§
Source§impl ArrayBuilder
impl ArrayBuilder
Use ArrayBuilder to produce JSON arrays
pub fn new() -> ArrayBuilder
Sourcepub fn from_json(array: Value) -> Option<ArrayBuilder>
pub fn from_json(array: Value) -> Option<ArrayBuilder>
Initialize builder with initial value.
Sourcepub fn build<F>(builder: F) -> ArrayBuilderwhere
F: FnOnce(&mut ArrayBuilder),
pub fn build<F>(builder: F) -> ArrayBuilderwhere
F: FnOnce(&mut ArrayBuilder),
Create new ArrayBuilder, pass it to closure as mutable ref and return.
Sourcepub fn array<F>(&mut self, builder: F)where
F: FnOnce(&mut ArrayBuilder),
pub fn array<F>(&mut self, builder: F)where
F: FnOnce(&mut ArrayBuilder),
Create new array and push it.
Sourcepub fn object<F>(&mut self, builder: F)where
F: FnOnce(&mut ObjectBuilder),
pub fn object<F>(&mut self, builder: F)where
F: FnOnce(&mut ObjectBuilder),
Create new object and push it
Sourcepub fn null(&mut self)
pub fn null(&mut self)
It you call null
, this array will be converted to null when converting
to raw JSON value.
pub fn root(&mut self, root: &str)
pub fn has_root(&mut self) -> bool
Source§impl ArrayBuilder
impl ArrayBuilder
Source§impl ArrayBuilder
impl ArrayBuilder
Sourcepub fn objects<A, T: Iterator<Item = A>, F>(&mut self, iter: T, func: F)where
F: Fn(A, &mut ObjectBuilder),
pub fn objects<A, T: Iterator<Item = A>, F>(&mut self, iter: T, func: F)where
F: Fn(A, &mut ObjectBuilder),
Fill this array by objects builded from iterator.
pub fn arrays<A, T: Iterator<Item = A>, F>(&mut self, iter: T, func: F)where
F: Fn(A, &mut ArrayBuilder),
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ArrayBuilder
impl RefUnwindSafe for ArrayBuilder
impl Send for ArrayBuilder
impl Sync for ArrayBuilder
impl Unpin for ArrayBuilder
impl UnwindSafe for ArrayBuilder
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more