Skip to main content

parse_pack

Function parse_pack 

Source
pub fn parse_pack(
    source: &str,
    source_kind: PackSource,
) -> Result<LibraryPack, PackError>
Expand description

Parse a .zen pack source into a LibraryPack tagged with source_kind.

Pack identity is derived from the document’s libraries block: the library entry whose id matches the document’s project id is the SELF-entry; if no entry matches the project id but there is exactly one library entry, that sole entry is used. A pack with no identifying library self-entry is an error (a pack MUST declare its identity).

Items are the document’s component ids in source order, followed by its FILTER token ids in source order. (Only filter tokens are exported items; color/dimension tokens are dependencies, not items.)

§Errors

Returns PackError when the source fails to parse, or when no library self-entry can be determined.