Skip to main content

should_stream

Function should_stream 

Source
pub fn should_stream(
    content_dir: &Path,
    budget: &MemoryBudget,
    explicitly_set: bool,
) -> bool
Expand description

Determines whether streaming compilation should be used.

Returns true if the content directory has more files than a single batch can hold, or if --max-memory was explicitly set.

§Examples

use ssg::streaming::{should_stream, MemoryBudget};
use tempfile::tempdir;

let dir = tempdir().unwrap();
let budget = MemoryBudget::default_budget();
// Explicitly set ⇒ always stream.
assert!(should_stream(dir.path(), &budget, true));