Bring more attention to short reads/slices on Buff/BuffMut (#231)

The property the Buff and BuffMut can return shorter slice is quite an
important detail. Nevertheless, while it is mentioned in the
documentation, the wording makes it relatively easy to overlook. This
tries to bring more attention to it.
This commit is contained in:
Michal 'vorner' Vaner
2018-11-17 16:51:28 +01:00
committed by Carl Lerche
parent c34a9f5083
commit 09f35cb09d
2 changed files with 4 additions and 2 deletions
+2 -1
View File
@@ -91,7 +91,8 @@ pub trait Buf {
fn remaining(&self) -> usize;
/// Returns a slice starting at the current position and of length between 0
/// and `Buf::remaining()`.
/// and `Buf::remaining()`. Note that this *can* return shorter slice (this allows
/// non-continuous internal representation).
///
/// This is a lower level function. Most operations are done with other
/// functions.
+2 -1
View File
@@ -121,7 +121,8 @@ pub trait BufMut {
}
/// Returns a mutable slice starting at the current BufMut position and of
/// length between 0 and `BufMut::remaining_mut()`.
/// length between 0 and `BufMut::remaining_mut()`. Note that this *can* be shorter than the
/// whole remainder of the buffer (this allows non-continuous implementation).
///
/// This is a lower level function. Most operations are done with other
/// functions.