Coverage Report

Created: 2026-01-16 07:00

next uncovered line (L), next uncovered region (R), next uncovered branch (B)
/rust/registry/src/index.crates.io-1949cf8c6b5b557f/lzma-rs-0.2.0/src/encode/lzma2.rs
Line
Count
Source
1
use byteorder::{BigEndian, WriteBytesExt};
2
use std::io;
3
4
0
pub fn encode_stream<R, W>(input: &mut R, output: &mut W) -> io::Result<()>
5
0
where
6
0
    R: io::BufRead,
7
0
    W: io::Write,
8
{
9
0
    let mut buf = vec![0u8; 0x10000];
10
    loop {
11
0
        let n = input.read(&mut buf)?;
12
0
        if n == 0 {
13
            // status = EOF
14
0
            output.write_u8(0)?;
15
0
            break;
16
0
        }
17
18
        // status = uncompressed reset dict
19
0
        output.write_u8(1)?;
20
        // unpacked size
21
0
        output.write_u16::<BigEndian>((n - 1) as u16)?;
22
        // contents
23
0
        output.write_all(&buf[..n])?;
24
    }
25
0
    Ok(())
26
0
}