Function git_features::hash::bytes

source ·
pub fn bytes(
    read: impl Read,
    num_bytes_from_start: usize,
    kind: Kind,
    progress: &mut impl Progress,
    should_interrupt: &AtomicBool
) -> Result<ObjectId>
Available on crate feature progress and (crate features rustsha1 or fast-sha1) only.
Expand description

Similar to bytes_of_file, but operates on an already open file.

Examples found in repository?
src/hash.rs (lines 104-110)
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
pub fn bytes_of_file(
    path: impl AsRef<std::path::Path>,
    num_bytes_from_start: usize,
    kind: git_hash::Kind,
    progress: &mut impl crate::progress::Progress,
    should_interrupt: &std::sync::atomic::AtomicBool,
) -> std::io::Result<git_hash::ObjectId> {
    bytes(
        std::fs::File::open(path)?,
        num_bytes_from_start,
        kind,
        progress,
        should_interrupt,
    )
}