lite_json/traits.rs
1#[cfg(not(feature = "std"))]
2extern crate alloc;
3
4#[cfg(not(feature = "std"))]
5use alloc::vec::Vec;
6
7pub trait Serialize {
8 fn serialize(&self) -> Vec<u8> {
9 let mut res = Vec::new();
10 self.serialize_to(&mut res, 0, 0);
11 res
12 }
13 fn format(&self, indent: u32) -> Vec<u8> {
14 let mut res = Vec::new();
15 self.serialize_to(&mut res, indent, 0);
16 res
17 }
18 fn serialize_to(&self, buffer: &mut Vec<u8>, indent: u32, level: u32);
19}