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
//! A `no_std`-friendly library for parsing and generation of Image4 images written in pure Rust.
//!
//! This library is currently in **EXPERIMENTAL** state. It's very likely that the API changes in
//! the future.
//!
//! # Usage
//!
//! This library is based on the [`der`] crate. Decoding and encoding is based on the [`Decode`] and
//! [`Encode`] traits.
//!
//! An Image4 file may be decoded as follows:
//!
//! ```
//! use image4::{der::Decode, ImageRef, Tag};
//!
//! # fn test() -> der::Result<()> {
//! let bytes = include_bytes!("../tests/data/test.img4");
//! let image = ImageRef::from_der(bytes)?;
//!
//! assert_eq!(image.payload().tag(), Tag::from_bytes(*b"TEST"));
//! # Ok(())
//! # }
//! ```
//!
//! ## Supported formats
//!
//! The library supports the following formats:
//!
//! * Full Image4 containers (IMG4) via the [`ImageRef`] and [`Image`] types;
//! * Image4 payload files (IM4P) via the [`PayloadRef`] and [`Payload`] types;
//! * Image4 manifest files (IM4M) via the [`ManifestRef`] and [`Manifest`] types.
//!
//! Additionally the new payload properties format (PAYP) is supported via the [`PayloadPropsRef`]
//! and [`PayloadProps`] types, though it likely isn't stored as a separate file.
//!
//! # Features
//!
//! * `alloc`: enables owned versions of reference types, [`alloc`] support in [`der`] and decoding
//! of Image4 properties.
//! * `std`: implements [`std::error::Error`] trait on provided errors, enables [`std`] support in
//! the [`der`] crate.
//! * `payload`: enables the [`payload`] module.
//! * `manifest`: enables the [`manifest`] module.
//! * `restore_info`: enables the [`restore_info`] module.
//! * `image`: enables the [`image`] module, requires `payload`, `manifest` and `restore_info`
//! features.
//! * `serde`: implements (de)serialization for Image4 property lists. Useful for translating
//! payload properties and manifest bodies to other formats and vice versa. Disabled by default.
//! * `property`: adds support for Image4 property lists (enables the [`property`] module). These
//! are an implementation detail of the Image4 format and usually shouldn't be used directly.
//!
//! All features are enabled by default.
//!
//! [`Decode`]: der::Decode
//! [`Encode`]: der::Encode
//! [`PayloadPropsRef`]: payload::PayloadPropsRef
//! [`PayloadProps`]: payload::PayloadProps
extern crate alloc;
extern crate std;
pub use ;
pub use Image;
pub use ImageRef;
pub use Manifest;
pub use ManifestRef;
pub use Payload;
pub use PayloadRef;
pub use RestoreInfo;
pub use RestoreInfoRef;
pub use Tag;