mirror of
https://github.com/tokio-rs/bytes.git
synced 2026-08-07 00:00:13 +02:00
get_vec_pos: use &self instead of &mut self (#670)
I can't see any reason that get_vec_pos needs a &mut self.
This commit is contained in:
+3
-3
@@ -243,7 +243,7 @@ impl BytesMut {
|
|||||||
/// th.join().unwrap();
|
/// th.join().unwrap();
|
||||||
/// ```
|
/// ```
|
||||||
#[inline]
|
#[inline]
|
||||||
pub fn freeze(mut self) -> Bytes {
|
pub fn freeze(self) -> Bytes {
|
||||||
if self.kind() == KIND_VEC {
|
if self.kind() == KIND_VEC {
|
||||||
// Just re-use `Bytes` internal Vec vtable
|
// Just re-use `Bytes` internal Vec vtable
|
||||||
unsafe {
|
unsafe {
|
||||||
@@ -978,7 +978,7 @@ impl BytesMut {
|
|||||||
}
|
}
|
||||||
|
|
||||||
#[inline]
|
#[inline]
|
||||||
unsafe fn get_vec_pos(&mut self) -> usize {
|
unsafe fn get_vec_pos(&self) -> usize {
|
||||||
debug_assert_eq!(self.kind(), KIND_VEC);
|
debug_assert_eq!(self.kind(), KIND_VEC);
|
||||||
|
|
||||||
self.data as usize >> VEC_POS_OFFSET
|
self.data as usize >> VEC_POS_OFFSET
|
||||||
@@ -1618,7 +1618,7 @@ impl PartialEq<Bytes> for BytesMut {
|
|||||||
}
|
}
|
||||||
|
|
||||||
impl From<BytesMut> for Vec<u8> {
|
impl From<BytesMut> for Vec<u8> {
|
||||||
fn from(mut bytes: BytesMut) -> Self {
|
fn from(bytes: BytesMut) -> Self {
|
||||||
let kind = bytes.kind();
|
let kind = bytes.kind();
|
||||||
|
|
||||||
let mut vec = if kind == KIND_VEC {
|
let mut vec = if kind == KIND_VEC {
|
||||||
|
|||||||
Reference in New Issue
Block a user