mirror of
https://github.com/tokio-rs/bytes.git
synced 2026-08-12 00:00:14 +02:00
Remove extra lifetime sigils
This commit is contained in:
@@ -99,7 +99,7 @@ impl MutBuf for AppendBuf {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
unsafe fn mut_bytes<'a>(&'a mut self) -> &'a mut [u8] {
|
||||
unsafe fn mut_bytes(&mut self) -> &mut [u8] {
|
||||
let wr = self.wr as usize;
|
||||
let cap = self.cap as usize;
|
||||
self.mem.mut_bytes_slice(wr, cap)
|
||||
|
||||
+4
-4
@@ -133,7 +133,7 @@ impl Buf for ByteBuf {
|
||||
}
|
||||
|
||||
#[inline]
|
||||
fn bytes<'a>(&'a self) -> &'a [u8] {
|
||||
fn bytes(&self) -> &[u8] {
|
||||
unsafe { &self.mem.bytes()[self.pos()..self.lim()] }
|
||||
}
|
||||
|
||||
@@ -212,7 +212,7 @@ impl MutByteBuf {
|
||||
cnt
|
||||
}
|
||||
|
||||
pub fn bytes<'a>(&'a self) -> &'a [u8] {
|
||||
pub fn bytes(&self) -> &[u8] {
|
||||
unsafe { &self.buf.mem.bytes()[..self.buf.pos()] }
|
||||
}
|
||||
}
|
||||
@@ -224,9 +224,9 @@ impl MutBuf for MutByteBuf {
|
||||
|
||||
unsafe fn advance(&mut self, cnt: usize) {
|
||||
self.buf.advance(cnt)
|
||||
}
|
||||
|
||||
unsafe fn mut_bytes<'a>(&'a mut self) -> &'a mut [u8] {
|
||||
}
|
||||
unsafe fn mut_bytes(&mut self) -> &mut [u8] {
|
||||
let pos = self.buf.pos();
|
||||
let lim = self.buf.lim();
|
||||
&mut self.buf.mem.mut_bytes()[pos..lim]
|
||||
|
||||
+2
-2
@@ -201,7 +201,7 @@ pub trait MutBuf {
|
||||
/// length between 0 and `MutBuf::remaining()`.
|
||||
///
|
||||
/// The returned byte slice may represent uninitialized memory.
|
||||
unsafe fn mut_bytes<'a>(&'a mut self) -> &'a mut [u8];
|
||||
unsafe fn mut_bytes(&mut self) -> &mut [u8];
|
||||
|
||||
fn copy_from<S: Source>(&mut self, src: S) -> usize
|
||||
where Self: Sized {
|
||||
@@ -617,7 +617,7 @@ impl<T: AsMut<[u8]> + AsRef<[u8]>> MutBuf for io::Cursor<T> {
|
||||
/// length between 0 and `MutBuf::remaining()`.
|
||||
///
|
||||
/// The returned byte slice may represent uninitialized memory.
|
||||
unsafe fn mut_bytes<'a>(&'a mut self) -> &'a mut [u8] {
|
||||
unsafe fn mut_bytes(&mut self) -> &mut [u8] {
|
||||
let pos = self.position() as usize;
|
||||
&mut (self.get_mut().as_mut())[pos..]
|
||||
}
|
||||
|
||||
+2
-2
@@ -41,7 +41,7 @@ impl<T: Buf> Buf for Take<T> {
|
||||
cmp::min(self.inner.remaining(), self.limit)
|
||||
}
|
||||
|
||||
fn bytes<'a>(&'a self) -> &'a [u8] {
|
||||
fn bytes(&self) -> &[u8] {
|
||||
&self.inner.bytes()[..self.limit]
|
||||
}
|
||||
|
||||
@@ -57,7 +57,7 @@ impl<T: MutBuf> MutBuf for Take<T> {
|
||||
cmp::min(self.inner.remaining(), self.limit)
|
||||
}
|
||||
|
||||
unsafe fn mut_bytes<'a>(&'a mut self) -> &'a mut [u8] {
|
||||
unsafe fn mut_bytes(&mut self) -> &mut [u8] {
|
||||
&mut self.inner.mut_bytes()[..self.limit]
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,8 @@ pub use imp::buf::{Buf, MutBuf};
|
||||
pub use imp::bytes::Bytes;
|
||||
|
||||
pub mod buf {
|
||||
//! Traits, helpers, and type definitions for working with buffers.
|
||||
|
||||
pub use imp::buf::{
|
||||
Source,
|
||||
Sink,
|
||||
|
||||
Reference in New Issue
Block a user