Skip to content

Commit c412bdc

Browse files
committed
switch to pin-project-lite
1 parent 9f33272 commit c412bdc

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

Cargo.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -18,4 +18,4 @@ futures = { version = "0.3", optional = true }
1818
nix = "0.14.0"
1919
mio = { version = "0.6", optional = true }
2020
tokio = { version = "0.2", optional = true, features = ["io-driver"] }
21-
pin-utils = "0.1.0-alpha.4"
21+
pin-project-lite = "0.1.4"

src/lib.rs

+10-6
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ extern crate futures;
4848
extern crate mio;
4949
extern crate nix;
5050
#[cfg(feature = "use_tokio")]
51-
extern crate pin_utils;
51+
extern crate pin_project_lite;
5252
#[cfg(feature = "use_tokio")]
5353
extern crate tokio;
5454

@@ -73,7 +73,7 @@ use mio::{Evented, Ready};
7373
use nix::sys::epoll::*;
7474
use nix::unistd::close;
7575
#[cfg(feature = "use_tokio")]
76-
use pin_utils::unsafe_pinned;
76+
use pin_project_lite::pin_project;
7777
#[cfg(feature = "use_tokio")]
7878
use tokio::io::PollEvented;
7979

@@ -683,12 +683,16 @@ impl Stream for PinStream {
683683
}
684684

685685
#[cfg(feature = "use_tokio")]
686-
pub struct PinValueStream { inner: PinStream }
686+
pin_project! {
687+
pub struct PinValueStream {
688+
#[pin]
689+
inner: PinStream
690+
}
691+
}
687692

688693
#[cfg(feature = "use_tokio")]
689694
impl PinValueStream {
690-
unsafe_pinned!(inner: PinStream);
691-
695+
692696
fn new(inner: PinStream) -> Self {
693697
PinValueStream { inner }
694698
}
@@ -704,7 +708,7 @@ impl Stream for PinValueStream {
704708
type Item = Result<u8>;
705709

706710
fn poll_next(mut self: SPin<&mut Self>, cx: &mut Context) -> Poll<Option<Self::Item>> {
707-
match self.as_mut().inner().poll_next(cx) {
711+
match self.as_mut().project().inner.poll_next(cx) {
708712
Poll::Ready(Some(res)) => {
709713
match res {
710714
Ok(_) => {

0 commit comments

Comments
 (0)