mirror of
https://github.com/tokio-rs/bytes.git
synced 2026-08-27 00:00:17 +02:00
remove unused Buf implementation. (#449)
The implementation of `Buf` for `Option<[u8; 1]>` was added to support `IntoBuf`. The `IntoBuf` trait has since been removed. Closes #444
This commit is contained in:
@@ -159,7 +159,6 @@ macro_rules! bench_group {
|
|||||||
mod get_u8 {
|
mod get_u8 {
|
||||||
use super::*;
|
use super::*;
|
||||||
bench_group!(get_u8);
|
bench_group!(get_u8);
|
||||||
bench!(option, option);
|
|
||||||
}
|
}
|
||||||
mod get_u16 {
|
mod get_u16 {
|
||||||
use super::*;
|
use super::*;
|
||||||
|
|||||||
@@ -1032,35 +1032,6 @@ impl Buf for &[u8] {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
impl Buf for Option<[u8; 1]> {
|
|
||||||
fn remaining(&self) -> usize {
|
|
||||||
if self.is_some() {
|
|
||||||
1
|
|
||||||
} else {
|
|
||||||
0
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
fn bytes(&self) -> &[u8] {
|
|
||||||
self.as_ref()
|
|
||||||
.map(AsRef::as_ref)
|
|
||||||
.unwrap_or(Default::default())
|
|
||||||
}
|
|
||||||
|
|
||||||
fn advance(&mut self, cnt: usize) {
|
|
||||||
if cnt == 0 {
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if self.is_none() {
|
|
||||||
panic!("overflow");
|
|
||||||
} else {
|
|
||||||
assert_eq!(1, cnt);
|
|
||||||
*self = None;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[cfg(feature = "std")]
|
#[cfg(feature = "std")]
|
||||||
impl<T: AsRef<[u8]>> Buf for std::io::Cursor<T> {
|
impl<T: AsRef<[u8]>> Buf for std::io::Cursor<T> {
|
||||||
fn remaining(&self) -> usize {
|
fn remaining(&self) -> usize {
|
||||||
|
|||||||
Reference in New Issue
Block a user