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: Json) -> 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) -> Json
Move out internal JSON value.
impl ObjectBuilder
[src]
fn set<V: ToJson, N: ToString>(&mut self, name: N, value: V)
Set object's name
field with something that can be
converted to json::Json value.
fn call<V: ToJson, N: ToString>(&mut self, name: N, value: V)
Stub for future use
impl ObjectBuilder
[src]
fn set_json<N: ToString>(&mut self, name: N, value: Json)
Set object's name
field with raw json::Json value.
fn array<N: ToString, 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: ToString, F>(&mut self, name: N, builder: F) where F: FnOnce(&mut ObjectBuilder)
Build new object and set object's name
field with it.