Flag Deref methods as #[inline] (#93)

This commit is contained in:
Alex Crichton
2017-03-24 07:39:57 -07:00
committed by Carl Lerche
parent 613d4bd5d5
commit 6c6c55d8e1
+5
View File
@@ -665,6 +665,7 @@ impl AsRef<[u8]> for Bytes {
impl ops::Deref for Bytes { impl ops::Deref for Bytes {
type Target = [u8]; type Target = [u8];
#[inline]
fn deref(&self) -> &[u8] { fn deref(&self) -> &[u8] {
self.inner.as_ref() self.inner.as_ref()
} }
@@ -1170,12 +1171,14 @@ impl AsRef<[u8]> for BytesMut {
impl ops::Deref for BytesMut { impl ops::Deref for BytesMut {
type Target = [u8]; type Target = [u8];
#[inline]
fn deref(&self) -> &[u8] { fn deref(&self) -> &[u8] {
self.as_ref() self.as_ref()
} }
} }
impl ops::DerefMut for BytesMut { impl ops::DerefMut for BytesMut {
#[inline]
fn deref_mut(&mut self) -> &mut [u8] { fn deref_mut(&mut self) -> &mut [u8] {
self.inner.as_mut() self.inner.as_mut()
} }
@@ -1999,12 +2002,14 @@ unsafe impl Sync for Inner {}
impl ops::Deref for Inner2 { impl ops::Deref for Inner2 {
type Target = Inner; type Target = Inner;
#[inline]
fn deref(&self) -> &Inner { fn deref(&self) -> &Inner {
&self.inner &self.inner
} }
} }
impl ops::DerefMut for Inner2 { impl ops::DerefMut for Inner2 {
#[inline]
fn deref_mut(&mut self) -> &mut Inner { fn deref_mut(&mut self) -> &mut Inner {
&mut self.inner &mut self.inner
} }