mirror of
https://github.com/openharmony/third_party_rust_bytes.git
synced 2026-07-21 04:15:24 -04:00
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:
committed by
Carl Lerche
parent
c34a9f5083
commit
09f35cb09d
+2
-1
@@ -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
@@ -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.
|
||||
|
||||
Reference in New Issue
Block a user