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
// saltpig -- the Rustic, ergonomic, and extensible CBOR implementation
// Copyright (C) 2018 Moonbolt{K}
//
// saltpig is free software: you may redistribute and/or modify it under
// version 3.0 or later of the GNU GPL (<LICENSE-GPL> or
// <https://www.gnu.org/licenses/gpl-3.0-standalone.html>), or the BSD 3-Clause
// License (<LICENSE-BSD> or <https://opensource.org/licenses/BSD-3-Clause>), at
// your option.
//
// saltpig is distributed in the hope that it will be useful, but WITHOUT ANY
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
// A PARTICULAR PURPOSE. See either of its licenses for more details.

//! `saltpig` is a CBOR implementation featuring [an ergonomic generic value
//! type], full use of [the][From] [standard][Into] [conversion][TryFrom]
//! [traits][TryInto], and [support for tagged values] (built-in and custom).
//! Additionally, efficient zero-allocation encoding and [`serde`] support are
//! planned for a future release.
//!
//! ## CBOR
//!
//! >The Concise Binary Object Representation (CBOR) is a data format
//! >whose design goals include the possibility of extremely small code
//! >size, fairly small message size, and extensibility without the need
//! >for version negotiation.  These design goals make it different from
//! >earlier binary serializations such as ASN.1 and MessagePack.
//!
//! — The CBOR standard, [RFC 7049]
//!
//! ## Cargo Features
//!
//! To avoid pulling in extra crates unnecessarily, `saltpig` makes the
//! [`extensions`] modules conditional on Cargo features beginning with `ext-`
//! (with the exception of [`extensions::cbor`], which requires only `saltpig`
//! and [`core`], and is thus always included). `saltpig` intends to support
//! [all standard tags] in this manner in a future release. See [the list of
//! `extensions`] for information on supported standard tags, and their feature
//! names and crate dependencies.
//!
//! [an ergonomic generic value type]: value/enum.Value.html
//! [From]: https://doc.rust-lang.org/std/convert/trait.From.html
//! [Into]: https://doc.rust-lang.org/std/convert/trait.Into.html
//! [TryFrom]: https://doc.rust-lang.org/std/convert/trait.TryFrom.html
//! [TryInto]: https://doc.rust-lang.org/std/convert/trait.TryInto.html
//! [support for tagged values]: extensions/index.html
//! [`serde`]: https://docs.serde.rs/serde/
//! [RFC 7049]: https://tools.ietf.org/html/rfc7049
//! [`extensions`]: extensions/index.html
//! [`extensions::cbor`]: extensions/cbor/index.html
//! [`core`]: https://doc.rust-lang.org/core/
//! [all standard tags]: https://www.iana.org/assignments/cbor-tags/cbor-tags.xhtml
//! [the list of `extensions`]: extensions/index.html

#![feature(try_from)]

extern crate core;

extern crate byteorder;
extern crate half;
#[macro_use]
extern crate maplit;

#[cfg(feature="ext-uuid")]
extern crate uuid;

#[cfg(test)]
extern crate quickcheck;
#[cfg(test)]
extern crate rand;

pub mod error;
pub mod extensions;
pub mod result;
mod test;
pub mod value;

mod de;

pub use ::error::Error;
pub use ::extensions::Extension;
pub use ::result::Result;
pub use ::value::Value;