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
pub fn new() -> ObjectBuilder
[src]
pub fn from_json(object: Value) -> Option<ObjectBuilder>
[src]
Initialize builder with initial value.
pub fn build<F>(builder: F) -> ObjectBuilder where
F: FnOnce(&mut ObjectBuilder),
[src]
F: FnOnce(&mut ObjectBuilder),
Create new builder, pass it to closure as mutable ref and return.
pub fn null(&mut self)
[src]
It you call null
, this object will be converted to null.
pub fn skip(&mut self)
[src]
It you call skip
, this object will be skipped.
pub fn root(&mut self, root: &str)
[src]
pub fn has_root(&mut self) -> bool
[src]
pub fn unwrap(self) -> Value
[src]
Move out internal JSON value.
impl ObjectBuilder
[src]
pub fn set<V: Serialize, N: Into<String>>(&mut self, name: N, value: V)
[src]
Set object's name
field with something that can be
converted to Value value.
pub fn call<V: Serialize, N: Into<String>>(&mut self, name: N, value: V)
[src]
Stub for future use
impl ObjectBuilder
[src]
pub fn set_json<N: Into<String>>(&mut self, name: N, value: Value)
[src]
Set object's name
field with raw Value value.
pub fn array<N: Into<String>, F>(&mut self, name: N, builder: F) where
F: FnOnce(&mut ArrayBuilder),
[src]
F: FnOnce(&mut ArrayBuilder),
Build new array and set object's name
field with it.
pub fn object<N: Into<String>, F>(&mut self, name: N, builder: F) where
F: FnOnce(&mut ObjectBuilder),
[src]
F: FnOnce(&mut ObjectBuilder),
Build new object and set object's name
field with it.