From b3f86d8654aac8fb5b3d5556771c79813be45c01 Mon Sep 17 00:00:00 2001 From: Carl Lerche Date: Wed, 20 Nov 2019 12:59:44 -0800 Subject: [PATCH] remove either feature (#315) remove either feature --- Cargo.toml | 1 - azure-pipelines.yml | 1 - src/either.rs | 93 --------------------------------------------- src/lib.rs | 5 --- 4 files changed, 100 deletions(-) delete mode 100644 src/either.rs diff --git a/Cargo.toml b/Cargo.toml index bc4d670..9feb647 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -25,7 +25,6 @@ std = [] [dependencies] serde = { version = "1.0", optional = true } -either = { version = "1.5", default-features = false, optional = true } [dev-dependencies] loom = "0.2.10" diff --git a/azure-pipelines.yml b/azure-pipelines.yml index 416e1fb..18b5974 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -30,7 +30,6 @@ jobs: cross: true features: - serde - - either # Nightly - template: ci/azure-test-stable.yml diff --git a/src/either.rs b/src/either.rs deleted file mode 100644 index 9a0fd39..0000000 --- a/src/either.rs +++ /dev/null @@ -1,93 +0,0 @@ -use crate::{Buf, BufMut}; - -use either::Either; -use either::Either::*; - -#[cfg(feature = "std")] -use std::io::IoSlice; -#[cfg(feature = "std")] -use crate::buf::IoSliceMut; - -impl Buf for Either -where - L: Buf, - R: Buf, -{ - fn remaining(&self) -> usize { - match *self { - Left(ref b) => b.remaining(), - Right(ref b) => b.remaining(), - } - } - - fn bytes(&self) -> &[u8] { - match *self { - Left(ref b) => b.bytes(), - Right(ref b) => b.bytes(), - } - } - - #[cfg(feature = "std")] - fn bytes_vectored<'a>(&'a self, dst: &mut [IoSlice<'a>]) -> usize { - match *self { - Left(ref b) => b.bytes_vectored(dst), - Right(ref b) => b.bytes_vectored(dst), - } - } - - fn advance(&mut self, cnt: usize) { - match *self { - Left(ref mut b) => b.advance(cnt), - Right(ref mut b) => b.advance(cnt), - } - } - - fn copy_to_slice(&mut self, dst: &mut [u8]) { - match *self { - Left(ref mut b) => b.copy_to_slice(dst), - Right(ref mut b) => b.copy_to_slice(dst), - } - } -} - -impl BufMut for Either -where - L: BufMut, - R: BufMut, -{ - fn remaining_mut(&self) -> usize { - match *self { - Left(ref b) => b.remaining_mut(), - Right(ref b) => b.remaining_mut(), - } - } - - fn bytes_mut(&mut self) -> &mut [core::mem::MaybeUninit] { - match *self { - Left(ref mut b) => b.bytes_mut(), - Right(ref mut b) => b.bytes_mut(), - } - } - - #[cfg(feature = "std")] - fn bytes_vectored_mut<'a>(&'a mut self, dst: &mut [IoSliceMut<'a>]) -> usize { - match *self { - Left(ref mut b) => b.bytes_vectored_mut(dst), - Right(ref mut b) => b.bytes_vectored_mut(dst), - } - } - - unsafe fn advance_mut(&mut self, cnt: usize) { - match *self { - Left(ref mut b) => b.advance_mut(cnt), - Right(ref mut b) => b.advance_mut(cnt), - } - } - - fn put_slice(&mut self, src: &[u8]) { - match *self { - Left(ref mut b) => b.put_slice(src), - Right(ref mut b) => b.put_slice(src), - } - } -} diff --git a/src/lib.rs b/src/lib.rs index 69def08..c565aa7 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -96,11 +96,6 @@ pub use crate::bytes::Bytes; #[cfg(feature = "serde")] mod serde; -// Optional `Either` support -#[cfg(feature = "either")] -mod either; - - #[inline(never)] #[cold] fn abort() -> ! {