Struct jsonway::object_builder::ObjectBuilder [] [src]

pub struct ObjectBuilder {
    pub object: Object,
    pub null: bool,
    pub skip: bool,
    pub root: Option<String>,
}

Fields

object: Object null: bool skip: bool root: Option<String>

Methods

impl ObjectBuilder
[src]

ObjectBuilder is used to produce JSON objects

fn new() -> ObjectBuilder

fn from_json(object: Value) -> Option<ObjectBuilder>

Initialize builder with initial value.

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

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

fn null(&mut self)

It you call null, this object will be converted to null.

fn skip(&mut self)

It you call skip, this object 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 ObjectBuilder
[src]

fn set<V: Serialize, N: Into<String>>(&mut self, name: N, value: V)

Set object's name field with something that can be converted to Value value.

fn call<V: Serialize, N: Into<String>>(&mut self, name: N, value: V)

Stub for future use

impl ObjectBuilder
[src]

fn set_json<N: Into<String>>(&mut self, name: N, value: Value)

Set object's name field with raw Value value.

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

Build new array and set object's name field with it.

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

Build new object and set object's name field with it.

Trait Implementations

impl Serialize for ObjectBuilder
[src]

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

Copy self to new JSON instance.