pub struct JSONObjectWriter<'a> {
    pub buffer: &'a mut String,
    /* private fields */
}
Expand description

Helper for appending a JSON object to the borrowed buffer.

Appends ‘{’ on creation. Appends ‘}’ when dropped.

Fields§

§buffer: &'a mut String

Mutable borrow of buffer

Consider using the methods instead of using this field directly. This field should not be used unless you know what you are doing.

Implementations§

Creates a new JSONObjectWriter that writes to the given buffer. Writes ‘{’ to the buffer immediately.

Starts writing a nested object with given key:

Esacapes key, writes “"key":{” and returns a JSONObjectWriter

Starts writing a nested array with given key:

Esacapes key, writes “"key":[” and returns a JSONArrayWriter.

Escapes and appends key:value to the buffer

Writes a key without any value.

Consider using the methods value(key, value), object(key) and array(key) instead of using this method directly.

Warning: If you use this method, you will have to write the value to the buffer youself afterwards.

Drops the writer. Dropping causes ‘}’ to be appended to the buffer.

Writes the entire buffer to given writer and clears entire buffer on success.

Returns buffer length in bytes

Trait Implementations§

Executes the destructor for this type. Read more

Auto Trait Implementations§

Blanket Implementations§

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.