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
//! A byte-exact GVariant codec for the ostree on-disk format.
//!
//! A caller writes values as GVariant bytes in normal form and reads them
//! back. The checksum of each ostree metadata object is the hash of these
//! bytes, so each metadata checksum of ostrya depends on this crate. The
//! typed codec reads fields in place with no allocation. The crate has no
//! ostree knowledge.
//!
//! # Entry points
//!
//! - [`Type::parse`] reads a type signature.
//! - [`to_bytes`] writes a [`Value`] as normal-form bytes.
//! - [`from_bytes`] reads normal-form bytes as a [`Value`].
//! - [`GvEncode`] writes a Rust type as normal-form bytes.
//! - [`GvDecode`] reads a Rust type in place from normal-form bytes.
//! - [`to_text`] writes the GVariant text form of a value.
//! - [`from_text`] reads the GVariant text form.
//! - [`DictBuilder`] builds an `a{sv}` dict.
//!
//! # Examples
//!
//! ```
//! use ostrya_gvariant::{Type, Value, from_bytes, to_bytes};
//!
//! let ty = Type::parse("(su)")?;
//! let value = Value::Tuple(vec![Value::from("ostree"), Value::from(7u32)]);
//! let bytes = to_bytes(&ty, &value)?;
//! // The string, one padding byte, the `u`, and the framing offset 7.
//! assert_eq!(bytes, b"ostree\0\0\x07\0\0\0\x07");
//! assert_eq!(from_bytes(&ty, &bytes)?, value);
//! # Ok::<(), ostrya_gvariant::Error>(())
//! ```
pub use ;
pub use ;
pub use DictBuilder;
pub use ;
pub use ;
pub use ;
pub use ;
pub use ;
pub use Value;