On Wed, Sep 9, 2026 at 8:52 AM Alistair Popple <[email protected]> wrote:
>
> Signed-off-by: Alistair Popple <[email protected]>
> Suggested-by: Danilo Krummrich <[email protected]>

Acked-by: Miguel Ojeda <[email protected]>

Nit: if the suggestion happened in public, then a Link tag after it
would be nice.

> +    pub fn write_truncated<T: AsBytes>(&mut self, value: &T) -> 
> Result<usize> {
> +        let len = self.length.min(size_of::<T>());
> +        self.write_slice(&value.as_bytes()[..len])?;
> +        Ok(len)
> +    }

This could reuse `write_slice_partial()`, though it would need
`#[inline]` to make it generate the same code (but we may want to do
that anyway).

Thanks!

Cheers,
Miguel

Reply via email to