improve phrasing of CompressionScheme docs

This commit is contained in:
mehbark 2025-10-03 16:10:30 -04:00
parent a1f5e6843a
commit fd0662b66d
Signed by: mbk
GPG key ID: E333EC1335FFCCDB

View file

@ -10,14 +10,14 @@ pub trait CompressionScheme {
/// Encode some bytes into `buf`, returning a [`Header`][Self::Header].
///
/// This does not necessarily have to be deterministic,
/// but it **must** always be decodable by [`decode`](Self::decode).
/// but it **must** be decodable by [`decode`](Self::decode).
/// That is, [`decode`](Self::decode) ∘ [`encode`](Self::encode) = `id`.
fn encode(src: &[u8], buf: &mut BitVec) -> Self::Header;
/// Decode the given bits and header into `buf`.
///
/// This may panic on arbitrary input,
/// but it **must** always decode outputs of [`encode`](Self::encode).
/// but it **must** successfully decode outputs of [`encode`](Self::encode).
/// That is, [`decode`](Self::decode) ∘ [`encode`](Self::encode) = `id`.
fn decode(src: &BitSlice, header: &Self::Header, buf: &mut Vec<u8>);