Skip to main content

read_header_blocking

Function read_header_blocking 

fn read_header_blocking(
    reader: &mut impl Read,
) -> Result<Result<Header, HeaderError>>
Available on crate feature tokio only.
Expand description

Reads and decodes the header from the start of reader.

The outer Result is a real I/O failure, which must propagate. The inner one reports whether the header itself could be interpreted. A short read (EOF before a full header) is folded into HeaderError::TooShort, since from the caller’s perspective a too-short file and an explicitly truncated header are the same problem.