Coverage Report

Created: 2026-06-15 06:09

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/rust/registry/src/index.crates.io-1949cf8c6b5b557f/dhall-0.13.0/src/utils.rs
Line
Count
Source
1
use std::fs::File;
2
use std::io::Read;
3
use std::path::Path;
4
5
use crate::error::Error;
6
7
// Compute the sha256 hash of a bitstring.
8
0
pub fn sha256_hash(data: &[u8]) -> Box<[u8]> {
9
    use sha2::Digest;
10
0
    sha2::Sha256::digest(data).as_slice().into()
11
0
}
12
13
0
pub fn read_binary_file(path: impl AsRef<Path>) -> Result<Box<[u8]>, Error> {
14
0
    let mut buffer = Vec::new();
15
0
    File::open(path)?.read_to_end(&mut buffer)?;
16
0
    Ok(buffer.into())
17
0
}