Skip to main content

formats/
lib.rs

1// formats -- data formats as text: JSON, typed JSON records, an XML subset, Unicode encodings
2//
3//   json   strict bounded JSON (RFC 8259; duplicate member names and lone surrogates are
4//          errors): Value, Number (the exact token, no rounding through f64), parse /
5//          parse_with_limits, stringify / stringify_with_limits / stringify_pretty, Limits,
6//          Error { offset, kind }
7//   jmap   typed mapping of records and string enums over json::Value: Field, Json,
8//          record! / wire_enum!, list / from_list, str_of / u64_of / obj / empty_object
9//   xml    Reader: the strict pull reader (well-formed XML 1.0 with namespaces, events, offsets,
10//          skip; DOCTYPE refused); Lenient: the forgiving reader of files from editors (tokens,
11//          a DOCTYPE's entities within a budget); parse / parse_with(Limits) -> Node: a bounded
12//          tree of the strict subset (Unsupported for comments, CDATA, processing instructions
13//          and mixed content); escape, valid_char
14//   encoding  decode(bytes, limit) -> (String, Encoding) / encode(text, Encoding): UTF-8 with
15//          and without BOM, UTF-16 LE / BE, strict and without guessing; Charset: the single-byte
16//          sets of the web (WHATWG: windows-1252, ISO-8859-x, KOI8 ...) and of old files (the DOS
17//          code pages); MultiByte: Shift_JIS, EUC-JP, ISO-2022-JP, GBK, gb18030, Big5, EUC-KR;
18//          Decoder for input in pieces; label / decode_label / from_code_page: the WHATWG Encoding
19//          Standard's labels and decode, Windows code page numbers
20//
21// Every reader takes untrusted input: it checks the size before it reads and the nesting, the
22// values or the elements while it reads, and reports a malformed or too large input as an error,
23// never a panic.  Only alloc; no I/O.
24//
25// The encodings' tables and the WHATWG labels are generated (charsets.rs, cjk.rs and cjk.bin,
26// tools/gen_encodings.py).
27//
28// json and jmap came from agent_core, xml and encoding from base (0.3.0); agent_core::{json,
29// jmap, record!, wire_enum!} and base::{xml, encoding} remain as re-exports of these modules.
30#![no_std]
31#![forbid(unsafe_code)]
32
33extern crate alloc;
34
35mod charsets;
36mod cjk;
37mod decode;
38pub mod encoding;
39pub mod jmap;
40pub mod json;
41mod multibyte;
42pub mod xml;