1#![cfg_attr(docsrs, feature(doc_cfg))]
2#![doc = include_str!("../README.md")]
3#![deny(missing_docs)]
4#![cfg_attr(not(test), no_std)]
5
6#[cfg(feature = "alloc")]
7extern crate alloc;
8
9pub use core_json::*;
10
11mod primitives;
12mod float;
13mod option;
14mod sequences;
15mod string;
16
17#[cfg(feature = "alloc")]
18mod boxed;
19
20pub use float::JsonF64;
21
22pub trait JsonDeserialize: Sized {
27 fn deserialize<'read, 'parent, B: Read<'read>, S: Stack>(
29 value: Value<'read, 'parent, B, S>,
30 ) -> Result<Self, JsonError<'read, B, S>>;
31}
32
33pub trait JsonStructure: JsonDeserialize {
35 fn deserialize_structure<'read, B: Read<'read>, S: Stack>(
42 json: B,
43 ) -> Result<Self, JsonError<'read, B, S>> {
44 let mut json = Deserializer::new(json)?;
45 let value = json.value()?;
46 Self::deserialize(value)
47 }
48}
49
50pub trait JsonSerialize {
52 fn serialize(&self) -> impl Iterator<Item = char>;
57}