gamut/lib.rs
1//! `gamut` — the umbrella crate for a collection of space-efficient image encoding libraries.
2//!
3//! This crate re-exports the high-level APIs of the format-specific crates behind Cargo
4//! features, so a consumer compiles only the codecs they need:
5//!
6//! ```toml
7//! gamut = { version = "0.1", features = ["avif", "jxl"] }
8//! ```
9//!
10//! [`core`] (re-exported from [`gamut-core`](https://crates.io/crates/gamut-core)) is always
11//! available and provides the shared [`core::EncodeImage`] / [`core::DecodeImage`] traits, the
12//! branded [`core::ImageRef`] / [`core::ImageBuf`] buffers, and the common [`core::Error`] type.
13//! Each format module appears only when its feature is enabled.
14//!
15//! The `primitives` feature additionally re-exports the shared building blocks the codecs are
16//! made of — `color` (pixel formats / CICP), `dsp` (transforms), and `bitstream` (bit writer
17//! + AV1 symbol coder) — for tooling and sandbox use such as the `gamut` CLI.
18//!
19//! The `metadata` feature re-exports the shared image-metadata primitives (issue #34) — the
20//! TIFF/IFD container core (`ifd`) plus, as they land, the per-format crates (`exif`/`xmp`/`icc`/
21//! `iptc`) and the `metadata` facade that unifies them — for tooling and for the container crates
22//! to consume.
23//!
24//! The `isobmff` feature re-exports the ISOBMFF/HEIF still-image container primitive (`isobmff`) —
25//! the box tree shared by the AVIF and HEIC codecs — so tooling can read and write containers
26//! directly, independently of the codecs that fill them.
27//!
28//! The `codec-abi` feature re-exports the shared codestream-backend seam (`codec_abi`) — the
29//! `repr(C)` vtables and their object-safe Rust twin traits by which a foreign (C/FFI) or alternate
30//! codestream backend plugs into a format crate — for anyone implementing or adapting a backend.
31#![forbid(unsafe_code)]
32
33/// The version of this `gamut` library crate, taken from its `Cargo.toml` at compile time.
34///
35/// Exposed so tooling (e.g. the `gamut` CLI's `-V` output) can report the resolved library
36/// version without hardcoding it. Because each workspace crate is versioned independently, this
37/// can differ from the version of the binary or consumer that links it.
38pub const VERSION: &str = env!("CARGO_PKG_VERSION");
39
40#[cfg(feature = "av1")]
41pub use gamut_av1 as av1;
42#[cfg(feature = "av2")]
43pub use gamut_av2 as av2;
44#[cfg(feature = "avif")]
45pub use gamut_avif as avif;
46#[cfg(feature = "primitives")]
47pub use gamut_bitstream as bitstream;
48#[cfg(feature = "codec-abi")]
49pub use gamut_codec_abi as codec_abi;
50#[cfg(feature = "primitives")]
51pub use gamut_color as color;
52pub use gamut_core as core;
53#[cfg(feature = "dng")]
54pub use gamut_dng as dng;
55#[cfg(feature = "primitives")]
56pub use gamut_dsp as dsp;
57#[cfg(feature = "metadata")]
58pub use gamut_exif as exif;
59#[cfg(feature = "heic")]
60pub use gamut_heic as heic;
61#[cfg(feature = "metadata")]
62pub use gamut_icc as icc;
63#[cfg(feature = "metadata")]
64pub use gamut_ifd as ifd;
65#[cfg(feature = "metadata")]
66pub use gamut_iptc as iptc;
67#[cfg(feature = "isobmff")]
68pub use gamut_isobmff as isobmff;
69#[cfg(feature = "jpeg")]
70pub use gamut_jpeg as jpeg;
71#[cfg(feature = "jxl")]
72pub use gamut_jxl as jxl;
73#[cfg(feature = "metadata")]
74pub use gamut_metadata as metadata;
75#[cfg(feature = "png")]
76pub use gamut_png as png;
77#[cfg(feature = "tiff")]
78pub use gamut_tiff as tiff;
79#[cfg(feature = "tonemap")]
80pub use gamut_tonemap as tonemap;
81#[cfg(feature = "vvc")]
82pub use gamut_vvc as vvc;
83#[cfg(feature = "webp")]
84pub use gamut_webp as webp;
85#[cfg(feature = "metadata")]
86pub use gamut_xmp as xmp;