Skip to main content

build_entry

Function build_entry 

Source
pub fn build_entry(
    sources: Vec<String>,
    bytes: &[&[u8]],
    cache: Option<CachePolicy>,
) -> ManifestEntry
Expand description

Builds a ManifestEntry from sources + their bytes.

sources and bytes MUST be the same length and in matching order. The resulting entry is hashed via hash_sources.

§Panics

Panics in debug builds if the slice lengths disagree.

§Examples

use ssg_core::build_entry;

let entry = build_entry(
    vec!["a".into(), "b".into()],
    &[b"alpha", b"beta"],
    None,
);
assert_eq!(entry.sources, vec!["a", "b"]);
assert_eq!(entry.hash.len(), 64);