pub struct Encoder<W> { /* private fields */ }
Expand description
JSON encoder over any Write
-type.
Implementations§
Source§impl<W: Write> Encoder<W>
impl<W: Write> Encoder<W>
pub fn new(w: W) -> Encoder<W>
pub fn into_writer(self) -> W
pub fn writer_mut(&mut self) -> &mut W
pub fn to_json<T: ToJson>(&mut self, t: T) -> EncodeResult<()>
pub fn encode(&mut self, j: &Json) -> EncodeResult<()>
pub fn u8(&mut self, x: u8) -> EncodeResult<()>
pub fn u16(&mut self, x: u16) -> EncodeResult<()>
pub fn u32(&mut self, x: u32) -> EncodeResult<()>
pub fn u64(&mut self, x: u64) -> EncodeResult<()>
pub fn usize(&mut self, x: usize) -> EncodeResult<()>
pub fn i8(&mut self, x: i8) -> EncodeResult<()>
pub fn i16(&mut self, x: i16) -> EncodeResult<()>
pub fn i32(&mut self, x: i32) -> EncodeResult<()>
pub fn i64(&mut self, x: i64) -> EncodeResult<()>
pub fn isize(&mut self, x: isize) -> EncodeResult<()>
pub fn i128(&mut self, x: i128) -> EncodeResult<()>
pub fn u128(&mut self, x: u128) -> EncodeResult<()>
pub fn bool(&mut self, x: bool) -> EncodeResult<()>
pub fn null(&mut self) -> EncodeResult<()>
pub fn optional<T: ToJson>(&mut self, val: Option<T>) -> EncodeResult<()>
pub fn string<S: Borrow<str>>(&mut self, s: S) -> EncodeResult<()>
pub fn key<S: Borrow<str>>(&mut self, key: S) -> EncodeResult<()>
Sourcepub fn array(&mut self) -> EncodeResult<()>
pub fn array(&mut self) -> EncodeResult<()>
Begin encoding a new JSON array.
Must be paired with a call to Encoder::end()
.
Sourcepub fn object(&mut self) -> EncodeResult<()>
pub fn object(&mut self) -> EncodeResult<()>
Begin encoding a new JSON object.
Must be paired with a call to Encoder::end()
.
Sourcepub fn end(&mut self) -> EncodeResult<()>
pub fn end(&mut self) -> EncodeResult<()>
End a JSON array or object.
Auto Trait Implementations§
impl<W> Freeze for Encoder<W>where
W: Freeze,
impl<W> RefUnwindSafe for Encoder<W>where
W: RefUnwindSafe,
impl<W> Send for Encoder<W>where
W: Send,
impl<W> Sync for Encoder<W>where
W: Sync,
impl<W> Unpin for Encoder<W>where
W: Unpin,
impl<W> UnwindSafe for Encoder<W>where
W: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more