Skip to main content

Crate compmd_pack

Crate compmd_pack 

Source
Expand description

compmd-pack: the names CompMD packs and their files are known by (spec §6.4), each checked once, when it is made, so a name that could leave a folder, or isn’t a pack’s, can’t exist.

The processor (compmd, which re-exports this crate as compmd::pack) and every host’s code (compmd-host) use the same types, so a pack’s name, a release and a file’s place mean one thing everywhere.

use compmd_pack::{Integrity, PackName, Place};

let place: Place = "@kit/mermaid@1.2.0/dist/mermaid.js".parse()?;
assert_eq!(place.release.pack, "@kit/mermaid".parse::<PackName>()?);
assert_eq!(place.release.to_string(), "@kit/mermaid@1.2.0");
assert_eq!(place.path.as_str(), "dist/mermaid.js");

let integrity: Integrity = "sha512-9c1fQe0=".parse()?;
assert_eq!(integrity.to_string(), "sha512-9c1fQe0=");

Structs§

FilePath
A file’s path in a pack, dist/mermaid.js.
Integrity
An integrity, sha512-9c1fQe…. In JSON it is that string.
PackName
A pack’s name, @scope/name.
Place
A file of a pack, by its place. In JSON it is {"pack": …, "version": …, "path": …}.
ReleaseId
A pack at one version. In JSON it is {"pack": "@kit/mermaid", "version": "1.2.0"}.

Enums§

Algorithm
A hash’s algorithm.
Invalid
What is wrong with a text read as a pack’s name, a release, a path, a place or an integrity.