1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
//! Neodyn Exchange defines the interchange (serialization) format for Neodyn DB.
//!
//! ## Caveats
//!
//! Neodyn Exchange has three, *more or less equivalent* representations:
//!
//!   * An in-memory tree represented by the [`Value`](value/enum.Value.html)
//!     type and the corresponding [serializer](ser/value/index.html) and
//!     [deserializer](de/value/index.html);
//!   * A human-readable text format defined by the appropriate
//!     [serializer](ser/text/index.html) and [deserializer](de/text/index.html);
//!   * And a compact, efficient, machine-readable binary format,
//!     defined by its own [serializer](ser/binary/index.html) and
//!     [deserializer](de/binary/index.html).
//!
//! A best effort is made to bring (and keep) the semantics of these three
//! formats as close as possible. In particular, the formats are supposed to
//! be able to represent the same set of values. However, as usual, care must
//! be taken when serializing a value into one of the human-readable formats
//! and deserializing it from the compact binary format, or vice versa.
//!
//! Neodyn Exchange is a 64-bit format. 128-bit integers are supported as long
//! as their value dynamically fits into the 64-bit type of the same signedness.
//!
//! Floating-point values that represent a `NaN` will be serialized as `null`,
//! but `null` will not deserialize as `NaN`. This is in line with the behavior
//! of `serde_json`. Serializing `NaN` is discouraged anyway -- it is a weird
//! artefact of the past, and we should not be using it, since Rust has proper
//! optionals in the type system.
//!
//! ## Crate Features
//!
//! * `quickcheck`: provides `impl Arbitrary for Value`. Required for
//!   running tests: use `cargo test --release --features quickcheck`.
//! * `serde_json`: provides conversions (`From` and `TryFrom`) between
//!   `neodyn_xc::Value` and `serde_json::Value`.
//! * `chrono`: provides `impl From<DateTime> for Value`.
//! * `uuid`: provides `impl From<Uuid> for Value`.
//! * `full`: enable all of the above features.
#![doc(html_root_url = "https://docs.rs/neodyn_xc/0.3.0")]
#![forbid(unsafe_code)]
#![deny(missing_debug_implementations, missing_copy_implementations,
        trivial_casts, trivial_numeric_casts,
        unstable_features,
        anonymous_parameters, bare_trait_objects,
        variant_size_differences,
        unused_qualifications, missing_docs,
        clippy::correctness, clippy::complexity, clippy::style,
        clippy::perf, clippy::pedantic, clippy::cargo, clippy::nursery,
        clippy::create_dir, clippy::else_if_without_else, clippy::exit,
        clippy::filetype_is_file, clippy::float_cmp_const, clippy::get_unwrap,
        clippy::inline_asm_x86_att_syntax, clippy::let_underscore_must_use,
        clippy::lossy_float_literal, clippy::map_err_ignore,
        clippy::mem_forget, clippy::missing_docs_in_private_items,
        clippy::multiple_inherent_impl, clippy::panic_in_result_fn,
        clippy::pattern_type_mismatch, /* !!! match ergonomics !!! */
        clippy::rc_buffer, clippy::rest_pat_in_fully_bound_structs,
        /* clippy::semicolon_if_nothing_returned, */ // seems not available yet
        clippy::shadow_reuse,
        clippy::shadow_same, clippy::str_to_string, clippy::string_add,
        clippy::string_to_string, clippy::unneeded_field_pattern,
        clippy::unwrap_in_result, clippy::unwrap_used,
        clippy::verbose_file_reads, clippy::wildcard_enum_match_arm)]
#![warn(clippy::dbg_macro, clippy::decimal_literal_representation,
        clippy::panic, clippy::print_stderr, clippy::print_stdout,
        clippy::todo, clippy::unimplemented, clippy::use_debug)]
#![allow(clippy::as_conversions, clippy::clone_on_ref_ptr,
         clippy::enum_glob_use,
         clippy::float_arithmetic, clippy::implicit_return,
         clippy::indexing_slicing, clippy::inline_asm_x86_intel_syntax,
         clippy::integer_arithmetic, clippy::integer_division,
         clippy::match_on_vec_items, clippy::missing_errors_doc,
         clippy::missing_inline_in_public_items, clippy::modulo_arithmetic,
         clippy::needless_pass_by_value, clippy::redundant_field_names,
         clippy::redundant_pattern, clippy::single_match_else,
         clippy::type_repetition_in_bounds,
         clippy::unreachable, clippy::use_self, clippy::wildcard_imports)]

pub mod value;
pub mod ser;
pub mod de;
pub mod format;
pub mod error;
pub mod span;

pub use crate::{
    value::Value,
    ser::{
        value::to_value,
        text::to_string,
        binary::{ to_bytes, to_writer, to_writer_buffered },
    },
    de::{
        value::from_value,
        value_ref::from_value_ref,
        text::from_str,
        binary::{ from_bytes, from_reader, from_reader_buffered },
    },
};