Struct json_writer::JSONObjectWriter [−][src]
pub struct JSONObjectWriter<'a> {
pub buffer: &'a mut String,
// some fields omitted
}Expand description
Helper for appending a JSON object to the borrowed buffer.
Appends ‘{’ on creation. Appends ‘}’ when dropped.
Fields
buffer: &'a mut StringMutable 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.
Writes the entire buffer to given writer and clears entire buffer on success.
Returns buffer length in bytes
