Struct nu_json::builder::ObjectBuilder
source · [−]pub struct ObjectBuilder { /* private fields */ }
Expand description
This structure provides a simple interface for constructing a JSON object.
Implementations
sourceimpl ObjectBuilder
impl ObjectBuilder
sourcepub fn new() -> ObjectBuilder
pub fn new() -> ObjectBuilder
Construct an ObjectBuilder
.
sourcepub fn insert<S, V>(self, key: S, value: V) -> ObjectBuilder where
S: Into<String>,
V: Serialize,
pub fn insert<S, V>(self, key: S, value: V) -> ObjectBuilder where
S: Into<String>,
V: Serialize,
Insert a key-value pair into the object.
sourcepub fn insert_array<S, F>(self, key: S, f: F) -> ObjectBuilder where
S: Into<String>,
F: FnOnce(ArrayBuilder) -> ArrayBuilder,
pub fn insert_array<S, F>(self, key: S, f: F) -> ObjectBuilder where
S: Into<String>,
F: FnOnce(ArrayBuilder) -> ArrayBuilder,
Creates and passes an ObjectBuilder
into a closure, then inserts the resulting array into
this object.
sourcepub fn insert_object<S, F>(self, key: S, f: F) -> ObjectBuilder where
S: Into<String>,
F: FnOnce(ObjectBuilder) -> ObjectBuilder,
pub fn insert_object<S, F>(self, key: S, f: F) -> ObjectBuilder where
S: Into<String>,
F: FnOnce(ObjectBuilder) -> ObjectBuilder,
Creates and passes an ObjectBuilder
into a closure, then inserts the resulting object into
this object.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for ObjectBuilder
impl Send for ObjectBuilder
impl Sync for ObjectBuilder
impl Unpin for ObjectBuilder
impl UnwindSafe for ObjectBuilder
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more