1#![cfg_attr(docsrs, feature(doc_cfg))]
2#![doc = include_str!("../README.md")]
3#![deny(missing_docs)]
4#![cfg_attr(not(any(feature = "std", 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#[cfg(feature = "alloc")]
20mod maps;
21
22pub use float::JsonF64;
23
24pub trait JsonDeserialize: Sized {
29 fn deserialize<'read, 'parent, B: Read<'read>, S: Stack>(
31 value: Value<'read, 'parent, B, S>,
32 ) -> Result<Self, JsonError<'read, B, S>>;
33}
34
35pub trait JsonStructure: JsonDeserialize {
37 fn deserialize_structure<'read, B: Read<'read>, S: Stack>(
44 json: B,
45 ) -> Result<Self, JsonError<'read, B, S>> {
46 let mut json = Deserializer::new(json)?;
47 let value = json.value()?;
48 Self::deserialize(value)
49 }
50}
51
52pub trait JsonSerialize {
54 fn serialize(&self) -> impl Iterator<Item = char>;
59}