Expand description
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};
let bytes = include_bytes!("../tests/data/test.img4");
let image = ImageRef::from_der(bytes)?;
assert_eq!(image.payload().tag(), Tag::from_bytes(*b"TEST"));
§Supported formats
The library supports the following formats:
- Full Image4 containers (IMG4) via the
ImageRef
andImage
types; - Image4 payload files (IM4P) via the
PayloadRef
andPayload
types; - Image4 manifest files (IM4M) via the
ManifestRef
andManifest
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 inder
and decoding of Image4 properties.std
: implementsstd::error::Error
trait on provided errors, enablesstd
support in theder
crate.payload
: enables thepayload
module.manifest
: enables themanifest
module.restore_info
: enables therestore_info
module.image
: enables theimage
module, requirespayload
,manifest
andrestore_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 theproperty
module). These are an implementation detail of the Image4 format and usually shouldn’t be used directly.
All features are enabled by default.
Re-exports§
pub use image::Image;
image
andalloc
pub use image::ImageRef;
image
pub use manifest::Manifest;
manifest
andalloc
pub use manifest::ManifestRef;
manifest
pub use payload::Payload;
payload
andalloc
pub use payload::PayloadRef;
payload
pub use restore_info::RestoreInfo;
restore_info
andalloc
pub use restore_info::RestoreInfoRef;
restore_info
pub use der;
Modules§
- image
image
- Contains the
ImageRef
andImage
types that represent an Image4 container (an IMG4 file). - manifest
manifest
- Contains the
ManifestRef
,Manifest
types that both represent a signed Image4 manifest, their unsigned counterparts and supporting types. - payload
payload
- Contains types used to parse and generate Image4 payload files (aka IM4P).
- property
property
- Contains everything needed to implement Image4 properties parsing.
- restore_
info restore_info
- Contains the
RestoreInfo
type that represents Image4 restore info (an IM4R file).
Structs§
- Tag
- A 4CC tag that is common in the Image4 format.
Type Aliases§
- Result
- Result type.