diff --git a/Cargo.toml b/Cargo.toml index 09b3697..036092f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,8 +7,6 @@ status = "actively-developed" repository = "najamelan/pharos" [dependencies] -pin-project = "^0.4.0-beta" - [dependencies.futures-preview] features = ["async-await", "nightly"] version = "^0.3.0-alpha" diff --git a/Cargo.yml b/Cargo.yml index 8e1169c..8ea4b6e 100644 --- a/Cargo.yml +++ b/Cargo.yml @@ -44,5 +44,4 @@ badges: dependencies: futures-preview : { version: ^0.3.0-alpha, features: [async-await, nightly] } - pin-project : ^0.4.0-beta diff --git a/src/events.rs b/src/events.rs index 830edfc..b133980 100644 --- a/src/events.rs +++ b/src/events.rs @@ -68,12 +68,10 @@ impl Stream for Events where Event: Clone + 'static + Send /// The sender of the channel. /// For pharos 0.3.0 on x64 Linux: `std::mem::size_of::>() == 56` // -#[ pin_project ] -// pub(crate) enum Sender where Event: Clone + 'static + Send { - Bounded { #[pin] tx: FutSender , filter: Option> } , - Unbounded{ #[pin] tx: FutUnboundedSender, filter: Option> } , + Bounded { tx: FutSender , filter: Option> } , + Unbounded{ tx: FutUnboundedSender, filter: Option> } , } @@ -144,12 +142,10 @@ impl Sender where Event: Clone + 'static + Send /// The receiver of the channel. // -#[ pin_project ] -// enum Receiver where Event: Clone + 'static + Send { - Bounded { #[pin] rx: FutReceiver } , - Unbounded{ #[pin] rx: FutUnboundedReceiver } , + Bounded { rx: FutReceiver } , + Unbounded{ rx: FutUnboundedReceiver } , } @@ -186,16 +182,12 @@ impl Stream for Receiver where Event: Clone + 'static + Send { type Item = Event; - #[ project ] - // fn poll_next( self: Pin<&mut Self>, cx: &mut Context<'_> ) -> Poll< Option > { - #[ project ] - // - match self.project() + match self.get_mut() { - Receiver::Bounded { rx } => rx.poll_next( cx ), - Receiver::Unbounded{ rx } => rx.poll_next( cx ), + Receiver::Bounded { rx } => Pin::new( rx ).poll_next( cx ), + Receiver::Unbounded{ rx } => Pin::new( rx ).poll_next( cx ), } } } @@ -206,57 +198,43 @@ impl Sink for Sender where Event: Clone + 'static + Send { type Error = Error; - #[ project ] - // + fn poll_ready( self: Pin<&mut Self>, cx: &mut Context<'_> ) -> Poll> { - #[ project ] - // - match self.project() + match self.get_mut() { - Sender::Bounded { tx, .. } => tx.poll_ready( cx ).map_err( Into::into ), - Sender::Unbounded{ tx, .. } => tx.poll_ready( cx ).map_err( Into::into ), + Sender::Bounded { tx, .. } => Pin::new( tx ).poll_ready( cx ).map_err( Into::into ), + Sender::Unbounded{ tx, .. } => Pin::new( tx ).poll_ready( cx ).map_err( Into::into ), } } - #[ project ] - // + fn start_send( self: Pin<&mut Self>, item: Event ) -> Result<(), Self::Error> { - #[ project ] - // - match self.project() + match self.get_mut() { - Sender::Bounded { tx, .. } => tx.start_send( item ).map_err( Into::into ), - Sender::Unbounded{ tx, .. } => tx.start_send( item ).map_err( Into::into ), + Sender::Bounded { tx, .. } => Pin::new( tx ).start_send( item ).map_err( Into::into ), + Sender::Unbounded{ tx, .. } => Pin::new( tx ).start_send( item ).map_err( Into::into ), } } - /// This will do a send under the hood, so the same errors as from start_send can occur here. - // - #[ project ] - // + fn poll_flush( self: Pin<&mut Self>, cx: &mut Context<'_> ) -> Poll> { - #[ project ] - // - match self.project() + match self.get_mut() { - Sender::Bounded { tx, .. } => tx.poll_flush( cx ).map_err( Into::into ), - Sender::Unbounded{ tx, .. } => tx.poll_flush( cx ).map_err( Into::into ), + Sender::Bounded { tx, .. } => Pin::new( tx ).poll_flush( cx ).map_err( Into::into ), + Sender::Unbounded{ tx, .. } => Pin::new( tx ).poll_flush( cx ).map_err( Into::into ), } } - #[ project ] - // + fn poll_close( self: Pin<&mut Self>, cx: &mut Context<'_> ) -> Poll> { - #[ project ] - // - match self.project() + match self.get_mut() { - Sender::Bounded { tx, .. } => tx.poll_close( cx ).map_err( Into::into ), - Sender::Unbounded{ tx, .. } => tx.poll_close( cx ).map_err( Into::into ), + Sender::Bounded { tx, .. } => Pin::new( tx ).poll_close( cx ).map_err( Into::into ), + Sender::Unbounded{ tx, .. } => Pin::new( tx ).poll_close( cx ).map_err( Into::into ), } } } diff --git a/src/lib.rs b/src/lib.rs index 48c8972..12504bc 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -55,7 +55,6 @@ mod import { std :: { fmt, error::Error as ErrorTrait, ops::Deref, any::type_name } , std :: { task::{ Poll, Context }, pin::Pin } , - pin_project :: { project, pin_project } , futures :: {