compmd_pack/lib.rs
1//! `compmd-pack`: the names [CompMD](https://compmd.dev/) packs and their files are known by (spec ยง6.4), each
2//! checked once, when it is made, so a name that could leave a folder, or isn't a pack's, can't exist.
3//!
4//! The processor (`compmd`, which re-exports this crate as `compmd::pack`) and every host's code (`compmd-host`) use
5//! the same types, so a pack's name, a release and a file's place mean one thing everywhere.
6//!
7//! ```
8//! use compmd_pack::{Integrity, PackName, Place};
9//!
10//! let place: Place = "@kit/mermaid@1.2.0/dist/mermaid.js".parse()?;
11//! assert_eq!(place.release.pack, "@kit/mermaid".parse::<PackName>()?);
12//! assert_eq!(place.release.to_string(), "@kit/mermaid@1.2.0");
13//! assert_eq!(place.path.as_str(), "dist/mermaid.js");
14//!
15//! let integrity: Integrity = "sha512-9c1fQe0=".parse()?;
16//! assert_eq!(integrity.to_string(), "sha512-9c1fQe0=");
17//! # Ok::<(), compmd_pack::Invalid>(())
18//! ```
19
20mod file_path;
21mod integrity;
22mod invalid;
23mod name;
24mod place;
25mod release;
26
27pub use file_path::FilePath;
28pub use integrity::{Algorithm, Integrity};
29pub use invalid::Invalid;
30pub use name::PackName;
31pub use place::Place;
32pub use release::ReleaseId;