Struct jsonway::array_builder::ArrayBuilder [] [src]

pub struct ArrayBuilder {
    pub array: Array,
    pub null: bool,
    pub skip: bool,
    pub root: Option<String>,
}

Fields

array: Array null: bool skip: bool root: Option<String>

Methods

impl ArrayBuilder
[src]

Use ArrayBuilder to produce JSON arrays

fn new() -> ArrayBuilder

fn from_json(array: Json) -> Option<ArrayBuilder>

Initialize builder with initial value.

fn build<F>(builder: F) -> ArrayBuilder where F: FnOnce(&mut ArrayBuilder)

Create new ArrayBuilder, pass it to closure as mutable ref and return.

fn push_json(&mut self, value: Json)

Push JSON value to array.

fn array<F>(&mut self, builder: F) where F: FnOnce(&mut ArrayBuilder)

Create new array and push it.

fn object<F>(&mut self, builder: F) where F: FnOnce(&mut ObjectBuilder)

Create new object and push it

fn null(&mut self)

It you call null, this array will be converted to null when converting to raw JSON value.

fn skip(&mut self)

It you call skip, this array will be skipped.

fn root(&mut self, root: &str)

fn has_root(&mut self) -> bool

fn unwrap(self) -> Json

Move out internal JSON value.

impl ArrayBuilder
[src]

fn push<T: ToJson>(&mut self, value: T)

Push to array something that can be converted to JSON.

impl ArrayBuilder
[src]

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.

fn arrays<A, T: Iterator<Item=A>, F>(&mut self, iter: T, func: F) where F: Fn(A, &mut ArrayBuilder)

fn map<A, T: Iterator<Item=A>, F>(&mut self, iter: T, func: F) where F: Fn(A) -> Json

Fill this array by JSON values builded from iterator.

Trait Implementations

impl ToJson for ArrayBuilder
[src]

fn to_json(&self) -> Json

Copy self to new JSON instance.