pub trait SerJson {
// Required method
fn ser_json(&self, d: usize, s: &mut SerJsonState);
// Provided method
fn serialize_json(&self) -> String { ... }
}
Expand description
A trait for objects that can be serialized to JSON.
Required Methods§
sourcefn ser_json(&self, d: usize, s: &mut SerJsonState)
fn ser_json(&self, d: usize, s: &mut SerJsonState)
Serialize Self to a JSON string.
let mut s = SerJsonState { out: String::new() };
42u32.ser_json(0, &mut s);
assert_eq!(s.out, "42");
Provided Methods§
sourcefn serialize_json(&self) -> String
fn serialize_json(&self) -> String
Serialize Self to a JSON string.
This is a convenient wrapper around ser_json
.