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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
//! # dCBOR: Deterministic CBOR Codec
//!
//! `dcbor` is a reference implementation of Deterministic CBOR. The current
//! specification of the norms and practices guiding the creation of this
//! implementation are currently found in this IETF Internet Draft:
//! [draft-mcnally-deterministic-cbor](https://datatracker.ietf.org/doc/draft-mcnally-deterministic-cbor/).
//!
//! # Getting Started
//!
//! Add the following to your `Cargo.toml`:
//!
//! ```toml
//! [dependencies]
//! dcbor = "0.25.2"
//! ```
//!
//! # Features
//!
//! ## Multi-threaded
//!
//! The `multithreaded` feature is available but not enabled by default. It uses
//! `Arc` for reference counting instead of `Rc`. To enable it, add the
//! following to your `Cargo.toml`:
//!
//! ```toml
//! [dependencies.dcbor]
//! version = "0.25.2"
//! features = ["multithreaded"]
//! ```
//!
//! ## `no_std`
//!
//! The `dcbor` library is `no_std` compatible. To use it in a `no_std`
//! environment, disable the default features in your `Cargo.toml` and enable
//! the `no_std` feature:
//!
//! ```toml
//! [dependencies.dcbor]
//! version = "0.25.2"
//! default-features = false
//! features = ["no_std"]
//! ```
//!
//! # Usage
//!
//! Encode an array of integers as CBOR.
//!
//! ```
//! # fn main() {
//! # {
//! use dcbor::prelude::*;
//! let array = [1000, 2000, 3000];
//! let cbor: CBOR = array.into();
//! assert_eq!(cbor.hex(), "831903e81907d0190bb8");
//! # }
//! # }
//! ```
//!
//! Decode CBOR binary back to an array of integers.
//!
//! ```
//! # fn main() {
//! # {
//! use dcbor::prelude::*;
//! let data = hex_literal::hex!("831903e81907d0190bb8");
//! let cbor = CBOR::try_from_data(&data).unwrap();
//! assert_eq!(cbor.diagnostic(), "[1000, 2000, 3000]");
//! let array: Vec<u32> = cbor.try_into().unwrap();
//! assert_eq!(format!("{:?}", array), "[1000, 2000, 3000]");
//! # }
//! # }
//! ```
//!
//! See the unit tests For further examples, including encoding and decoding
//! arrays with heterogenous elements, maps, and user-defined types with custom
//! CBOR tags.
pub use *;
pub use ByteString;
pub use CBORSortable;
pub use ;
pub use Date;
pub use DiagFormatOpts;
pub use HexFormatOpts;
pub use ;
pub use ;
pub use *;
pub use ;
pub use CBORTagged;
pub use CBORTaggedEncodable;
pub use CBORTaggedDecodable;
pub use CBORTaggedCodable;
pub use ;
pub use ;
pub use Simple;
use ExactFrom;
pub use ;
// Re-export standard library types used in our public API
pub use *;