mirror of
https://github.com/rust-lang/rust.git
synced 2025-05-14 02:49:40 +00:00

This renames `std::io::IoVec` to `std::io::IoSlice` and `std::io::IoVecMut` to `std::io::IoSliceMut`, and stabilizes `std::io::IoSlice`, `std::io::IoSliceMut`, `std::io::Read::read_vectored`, and `std::io::Write::write_vectored`. Closes #58452
33 lines
551 B
Rust
33 lines
551 B
Rust
pub struct IoSlice<'a>(&'a [u8]);
|
|
|
|
impl<'a> IoSlice<'a> {
|
|
#[inline]
|
|
pub fn new(buf: &'a [u8]) -> IoSlice<'a> {
|
|
IoSlice(buf)
|
|
}
|
|
|
|
#[inline]
|
|
pub fn as_slice(&self) -> &[u8] {
|
|
self.0
|
|
}
|
|
}
|
|
|
|
pub struct IoSliceMut<'a>(&'a mut [u8]);
|
|
|
|
impl<'a> IoSliceMut<'a> {
|
|
#[inline]
|
|
pub fn new(buf: &'a mut [u8]) -> IoSliceMut<'a> {
|
|
IoSliceMut(buf)
|
|
}
|
|
|
|
#[inline]
|
|
pub fn as_slice(&self) -> &[u8] {
|
|
self.0
|
|
}
|
|
|
|
#[inline]
|
|
pub fn as_mut_slice(&mut self) -> &mut [u8] {
|
|
self.0
|
|
}
|
|
}
|