bdinfo_rs_core/lib.rs
1//! `bdinfo-rs-core` — a memory-safe Blu-ray disc analyzer library.
2//!
3//! This is the library the `bdinfo-rs` CLI drives: it reads a Blu-ray disc
4//! structure (a BDMV folder tree or a UDF `.iso` image), parses the index,
5//! playlist, and clip-information files, demuxes the transport streams, and
6//! reports every elementary stream's codec details.
7//!
8//! Design rules:
9//! - `#![forbid(unsafe_code)]` — memory safety is the point.
10//! - Every read is bounds-checked and fallible; we never index raw or panic on input-derived bytes
11//! (the `indexing_slicing` / `unwrap_used` gate enforces this).
12//! - All multi-byte integers are big-endian and host-independent — with one exception: the UDF
13//! descriptors in `vfs::udf` are little-endian, per ECMA-167.
14#![forbid(unsafe_code)]
15// The library never writes to stdout/stderr — emitting output is the caller's
16// job. Workspace lints can't target a single crate, so this is crate-scoped on
17// top of `[lints] workspace = true`; the `bdinfo-rs` CLI keeps `println!`.
18#![deny(clippy::print_stdout, clippy::print_stderr)]
19
20pub mod bdrom;
21pub mod bitstream;
22pub mod bytes;
23pub mod codec;
24pub mod discovery;
25pub mod error;
26pub mod index;
27pub mod language_codes;
28pub mod primitives;
29pub mod report;
30pub mod stream;
31pub mod vfs;
32
33/// Returns the version of the `bdinfo-rs-core` library crate (its `CARGO_PKG_VERSION`).
34#[must_use]
35pub const fn version() -> &'static str {
36 env!("CARGO_PKG_VERSION")
37}
38
39#[cfg(test)]
40mod tests {
41 use super::version;
42
43 #[test]
44 fn version_matches_cargo_pkg_version() {
45 assert_eq!(version(), env!("CARGO_PKG_VERSION"));
46 }
47}