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

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>

Methods

impl ArrayBuilder
[src]

Use ArrayBuilder to produce JSON arrays

fn new() -> ArrayBuilder

fn from_json(array: Value) -> 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: Value)

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) -> Value

Move out internal JSON value.

impl ArrayBuilder
[src]

fn push<T: Serialize>(&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) -> Value

Fill this array by JSON values builded from iterator.

Trait Implementations

impl Serialize for ArrayBuilder
[src]

fn serialize<S>(&self, serializer: &mut S) -> Result<(), S::Error> where S: Serializer

Copy self to new JSON instance.