You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The documentation of the BufMut::writer claims that the returned writer will never fail:
This function returns a new value which implements Write by adapting the Write trait functions to the BufMut trait functions. Given that BufMut operations are infallible, none of the Write functions will return with Err.
This is, however, not true, it may error on not enough capacity in the buffer:
use std::io::Write;use bytes::BufMut;fnmain(){letmut buffer = [0;10];letmut w = buffer.writer();
w.write_all(b"Hello world").unwrap();}
I believe a similar can be achieved with the reader's read_exact and its documentation makes a similar claim.
To be clear, I think the actual behaviour is expected and the only reasonable way it could act. But maybe the documentation should be adjusted to claim something little weaker (like, returning errors related to end of buffer only)?
The text was updated successfully, but these errors were encountered:
The documentation of the BufMut::writer claims that the returned writer will never fail:
This is, however, not true, it may error on not enough capacity in the buffer:
I believe a similar can be achieved with the reader's
read_exact
and its documentation makes a similar claim.To be clear, I think the actual behaviour is expected and the only reasonable way it could act. But maybe the documentation should be adjusted to claim something little weaker (like, returning errors related to end of buffer only)?
The text was updated successfully, but these errors were encountered: