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 algorithm;
21mod file_path;
22mod integrity;
23mod invalid;
24mod name;
25mod place;
26mod range;
27mod release;
28
29pub use algorithm::Algorithm;
30pub use file_path::FilePath;
31pub use integrity::Integrity;
32pub use invalid::Invalid;
33pub use name::PackName;
34pub use place::Place;
35pub use range::{newest_matching, range};
36pub use release::ReleaseId;