mirror of
https://github.com/tokio-rs/bytes.git
synced 2026-08-08 00:00:26 +02:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
686ea198dd |
+9
-3
@@ -8,7 +8,7 @@ use alloc::{boxed::Box, vec::Vec};
|
|||||||
|
|
||||||
/// A trait for values that provide sequential write access to bytes.
|
/// A trait for values that provide sequential write access to bytes.
|
||||||
///
|
///
|
||||||
/// Write bytes to a buffer
|
/// Write bytes to a buffer.
|
||||||
///
|
///
|
||||||
/// A buffer stores bytes in memory such that write operations are infallible.
|
/// A buffer stores bytes in memory such that write operations are infallible.
|
||||||
/// The underlying storage may or may not be in contiguous memory. A `BufMut`
|
/// The underlying storage may or may not be in contiguous memory. A `BufMut`
|
||||||
@@ -122,8 +122,14 @@ pub unsafe trait BufMut {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// Returns a mutable slice starting at the current BufMut position and of
|
/// Returns a mutable slice starting at the current BufMut position and of
|
||||||
/// length between 0 and `BufMut::remaining_mut()`. Note that this *can* be shorter than the
|
/// length between 0 and `BufMut::remaining_mut()`. Note that this *can* be
|
||||||
/// whole remainder of the buffer (this allows non-continuous implementation).
|
/// shorter than the whole remainder of the buffer (this allows
|
||||||
|
/// non-continuous implementation).
|
||||||
|
///
|
||||||
|
/// Writing to a `BufMut` may involve allocating more memory on the fly.
|
||||||
|
/// Generally, such allocations happen when this method is called on a
|
||||||
|
/// container that has run out of capacity. Containers that behave this way
|
||||||
|
/// include [`Vec<u8>`](std::vec::Vec) and [`BytesMut`](crate::BytesMut).
|
||||||
///
|
///
|
||||||
/// This is a lower level function. Most operations are done with other
|
/// This is a lower level function. Most operations are done with other
|
||||||
/// functions.
|
/// functions.
|
||||||
|
|||||||
Reference in New Issue
Block a user