chore(dependencies): update pin-project to 0.4
This commit is contained in:
committed by
Sean McArthur
parent
d40978ce08
commit
bcb66736fb
17
Cargo.toml
17
Cargo.toml
@@ -32,7 +32,7 @@ iovec = "0.1"
|
|||||||
itoa = "0.4.1"
|
itoa = "0.4.1"
|
||||||
log = "0.4"
|
log = "0.4"
|
||||||
net2 = { version = "0.2.32", optional = true }
|
net2 = { version = "0.2.32", optional = true }
|
||||||
pin-project = { version = "=0.4.0-alpha.11", features = ["project_attr"] }
|
pin-project = "0.4"
|
||||||
time = "0.1"
|
time = "0.1"
|
||||||
tokio = { version = "=0.2.0-alpha.5", optional = true, default-features = false, features = ["rt-full"] }
|
tokio = { version = "=0.2.0-alpha.5", optional = true, default-features = false, features = ["rt-full"] }
|
||||||
tower-service = "=0.3.0-alpha.1"
|
tower-service = "=0.3.0-alpha.1"
|
||||||
@@ -193,3 +193,18 @@ required-features = ["runtime", "unstable-stream"]
|
|||||||
name = "server"
|
name = "server"
|
||||||
path = "tests/server.rs"
|
path = "tests/server.rs"
|
||||||
required-features = ["runtime", "unstable-stream"]
|
required-features = ["runtime", "unstable-stream"]
|
||||||
|
|
||||||
|
[patch.crates-io]
|
||||||
|
tokio = { git = "https://github.com/tokio-rs/tokio" }
|
||||||
|
tokio-codec = { git = "https://github.com/tokio-rs/tokio" }
|
||||||
|
tokio-executor = { git = "https://github.com/tokio-rs/tokio" }
|
||||||
|
tokio-fs = { git = "https://github.com/tokio-rs/tokio" }
|
||||||
|
tokio-io = { git = "https://github.com/tokio-rs/tokio" }
|
||||||
|
tokio-macros = { git = "https://github.com/tokio-rs/tokio" }
|
||||||
|
tokio-net = { git = "https://github.com/tokio-rs/tokio" }
|
||||||
|
tokio-sync = { git = "https://github.com/tokio-rs/tokio" }
|
||||||
|
tokio-test = { git = "https://github.com/tokio-rs/tokio" }
|
||||||
|
tokio-timer = { git = "https://github.com/tokio-rs/tokio" }
|
||||||
|
|
||||||
|
tower-service = { git = "https://github.com/taiki-e/tower", branch = "pin-project" }
|
||||||
|
tower-make = { git = "https://github.com/taiki-e/tower", branch = "pin-project" }
|
||||||
|
|||||||
@@ -98,9 +98,9 @@ where
|
|||||||
{
|
{
|
||||||
type Output = F::Output;
|
type Output = F::Output;
|
||||||
|
|
||||||
fn poll(mut self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> Poll<Self::Output> {
|
fn poll(self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> Poll<Self::Output> {
|
||||||
|
let mut me = self.project();
|
||||||
loop {
|
loop {
|
||||||
let me = self.project();
|
|
||||||
match mem::replace(me.state, State::Draining) {
|
match mem::replace(me.state, State::Draining) {
|
||||||
State::Watch(on_drain) => {
|
State::Watch(on_drain) => {
|
||||||
let recv = me.watch.rx.recv_ref();
|
let recv = me.watch.rx.recv_ref();
|
||||||
@@ -109,7 +109,7 @@ where
|
|||||||
match recv.poll_unpin(cx) {
|
match recv.poll_unpin(cx) {
|
||||||
Poll::Ready(None) => {
|
Poll::Ready(None) => {
|
||||||
// Drain has been triggered!
|
// Drain has been triggered!
|
||||||
on_drain(me.future);
|
on_drain(me.future.as_mut());
|
||||||
},
|
},
|
||||||
Poll::Ready(Some(_/*State::Open*/)) |
|
Poll::Ready(Some(_/*State::Open*/)) |
|
||||||
Poll::Pending => {
|
Poll::Pending => {
|
||||||
|
|||||||
@@ -254,11 +254,11 @@ where
|
|||||||
E: Into<Box<dyn StdError + Send + Sync>>,
|
E: Into<Box<dyn StdError + Send + Sync>>,
|
||||||
{
|
{
|
||||||
#[project]
|
#[project]
|
||||||
fn poll2(mut self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> Poll<crate::Result<()>> {
|
fn poll2(self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> Poll<crate::Result<()>> {
|
||||||
loop {
|
|
||||||
let mut me = self.project();
|
let mut me = self.project();
|
||||||
|
loop {
|
||||||
#[project]
|
#[project]
|
||||||
let next = match me.state.project() {
|
let next = match me.state.as_mut().project() {
|
||||||
H2StreamState::Service(h) => {
|
H2StreamState::Service(h) => {
|
||||||
let res = match h.poll(cx) {
|
let res = match h.poll(cx) {
|
||||||
Poll::Ready(Ok(r)) => r,
|
Poll::Ready(Ok(r)) => r,
|
||||||
|
|||||||
@@ -509,7 +509,7 @@ where
|
|||||||
///
|
///
|
||||||
/// This `Connection` should continue to be polled until shutdown
|
/// This `Connection` should continue to be polled until shutdown
|
||||||
/// can finish.
|
/// can finish.
|
||||||
pub fn graceful_shutdown(mut self: Pin<&mut Self>) {
|
pub fn graceful_shutdown(self: Pin<&mut Self>) {
|
||||||
match self.project().conn.as_mut().unwrap() {
|
match self.project().conn.as_mut().unwrap() {
|
||||||
Either::A(ref mut h1) => {
|
Either::A(ref mut h1) => {
|
||||||
h1.disable_keep_alive();
|
h1.disable_keep_alive();
|
||||||
@@ -727,8 +727,9 @@ where
|
|||||||
B: Payload,
|
B: Payload,
|
||||||
E: H2Exec<<S::Service as Service<Body>>::Future, B>,
|
E: H2Exec<<S::Service as Service<Body>>::Future, B>,
|
||||||
{
|
{
|
||||||
fn poll_next_(mut self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> Poll<Option<crate::Result<Connecting<IO, S::Future, E>>>> {
|
fn poll_next_(self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> Poll<Option<crate::Result<Connecting<IO, S::Future, E>>>> {
|
||||||
match ready!(self.project().make_service.poll_ready_ref(cx)) {
|
let me = self.project();
|
||||||
|
match ready!(me.make_service.poll_ready_ref(cx)) {
|
||||||
Ok(()) => (),
|
Ok(()) => (),
|
||||||
Err(e) => {
|
Err(e) => {
|
||||||
trace!("make_service closed");
|
trace!("make_service closed");
|
||||||
@@ -736,13 +737,13 @@ where
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if let Some(item) = ready!(self.project().incoming.poll_accept(cx)) {
|
if let Some(item) = ready!(me.incoming.poll_accept(cx)) {
|
||||||
let io = item.map_err(crate::Error::new_accept)?;
|
let io = item.map_err(crate::Error::new_accept)?;
|
||||||
let new_fut = self.project().make_service.make_service_ref(&io);
|
let new_fut = me.make_service.make_service_ref(&io);
|
||||||
Poll::Ready(Some(Ok(Connecting {
|
Poll::Ready(Some(Ok(Connecting {
|
||||||
future: new_fut,
|
future: new_fut,
|
||||||
io: Some(io),
|
io: Some(io),
|
||||||
protocol: self.protocol.clone(),
|
protocol: me.protocol.clone(),
|
||||||
})))
|
})))
|
||||||
} else {
|
} else {
|
||||||
Poll::Ready(None)
|
Poll::Ready(None)
|
||||||
@@ -781,10 +782,11 @@ where
|
|||||||
{
|
{
|
||||||
type Output = Result<Connection<I, S, E>, FE>;
|
type Output = Result<Connection<I, S, E>, FE>;
|
||||||
|
|
||||||
fn poll(mut self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> Poll<Self::Output> {
|
fn poll(self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> Poll<Self::Output> {
|
||||||
let service = ready!(self.project().future.poll(cx))?;
|
let me = self.project();
|
||||||
let io = self.project().io.take().expect("polled after complete");
|
let service = ready!(me.future.poll(cx))?;
|
||||||
Poll::Ready(Ok(self.protocol.serve_connection(io, service)))
|
let io = me.io.take().expect("polled after complete");
|
||||||
|
Poll::Ready(Ok(me.protocol.serve_connection(io, service)))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -816,15 +818,16 @@ where
|
|||||||
B: Payload,
|
B: Payload,
|
||||||
E: H2Exec<<S::Service as Service<Body>>::Future, B>,
|
E: H2Exec<<S::Service as Service<Body>>::Future, B>,
|
||||||
{
|
{
|
||||||
pub(super) fn poll_watch<W>(mut self: Pin<&mut Self>, cx: &mut task::Context<'_>, watcher: &W) -> Poll<crate::Result<()>>
|
pub(super) fn poll_watch<W>(self: Pin<&mut Self>, cx: &mut task::Context<'_>, watcher: &W) -> Poll<crate::Result<()>>
|
||||||
where
|
where
|
||||||
E: NewSvcExec<IO, S::Future, S::Service, E, W>,
|
E: NewSvcExec<IO, S::Future, S::Service, E, W>,
|
||||||
W: Watcher<IO, S::Service, E>,
|
W: Watcher<IO, S::Service, E>,
|
||||||
{
|
{
|
||||||
|
let mut me = self.project();
|
||||||
loop {
|
loop {
|
||||||
if let Some(connecting) = ready!(self.project().serve.poll_next_(cx)?) {
|
if let Some(connecting) = ready!(me.serve.as_mut().poll_next_(cx)?) {
|
||||||
let fut = NewSvcTask::new(connecting, watcher.clone());
|
let fut = NewSvcTask::new(connecting, watcher.clone());
|
||||||
self.project().serve.project().protocol.exec.execute_new_svc(fut)?;
|
me.serve.as_mut().project().protocol.exec.execute_new_svc(fut)?;
|
||||||
} else {
|
} else {
|
||||||
return Poll::Ready(Ok(()));
|
return Poll::Ready(Ok(()));
|
||||||
}
|
}
|
||||||
@@ -841,8 +844,7 @@ where
|
|||||||
type Output = A::Output;
|
type Output = A::Output;
|
||||||
|
|
||||||
#[project]
|
#[project]
|
||||||
fn poll(mut self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> Poll<Self::Output> {
|
fn poll(self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> Poll<Self::Output> {
|
||||||
// Just simple pin projection to the inner variants
|
|
||||||
#[project]
|
#[project]
|
||||||
match self.project() {
|
match self.project() {
|
||||||
Either::A(a) => a.poll(cx),
|
Either::A(a) => a.poll(cx),
|
||||||
@@ -939,16 +941,16 @@ pub(crate) mod spawn_all {
|
|||||||
type Output = ();
|
type Output = ();
|
||||||
|
|
||||||
#[project]
|
#[project]
|
||||||
fn poll(mut self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> Poll<Self::Output> {
|
fn poll(self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> Poll<Self::Output> {
|
||||||
// If it weren't for needing to name this type so the `Send` bounds
|
// If it weren't for needing to name this type so the `Send` bounds
|
||||||
// could be projected to the `Serve` executor, this could just be
|
// could be projected to the `Serve` executor, this could just be
|
||||||
// an `async fn`, and much safer. Woe is me.
|
// an `async fn`, and much safer. Woe is me.
|
||||||
|
|
||||||
loop {
|
|
||||||
let mut me = self.project();
|
let mut me = self.project();
|
||||||
|
loop {
|
||||||
let next = {
|
let next = {
|
||||||
#[project]
|
#[project]
|
||||||
match me.state.project() {
|
match me.state.as_mut().project() {
|
||||||
State::Connecting(connecting, watcher) => {
|
State::Connecting(connecting, watcher) => {
|
||||||
let res = ready!(connecting.poll(cx));
|
let res = ready!(connecting.poll(cx));
|
||||||
let conn = match res {
|
let conn = match res {
|
||||||
|
|||||||
@@ -214,7 +214,7 @@ where
|
|||||||
{
|
{
|
||||||
type Output = crate::Result<()>;
|
type Output = crate::Result<()>;
|
||||||
|
|
||||||
fn poll(mut self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> Poll<Self::Output> {
|
fn poll(self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> Poll<Self::Output> {
|
||||||
self.project().spawn_all.poll_watch(cx, &NoopWatcher)
|
self.project().spawn_all.poll_watch(cx, &NoopWatcher)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -61,12 +61,12 @@ where
|
|||||||
type Output = crate::Result<()>;
|
type Output = crate::Result<()>;
|
||||||
|
|
||||||
#[project]
|
#[project]
|
||||||
fn poll(mut self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> Poll<Self::Output> {
|
fn poll(self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> Poll<Self::Output> {
|
||||||
let mut me = self.project();
|
let mut me = self.project();
|
||||||
loop {
|
loop {
|
||||||
let next = {
|
let next = {
|
||||||
#[project]
|
#[project]
|
||||||
match me.state.project() {
|
match me.state.as_mut().project() {
|
||||||
State::Running {
|
State::Running {
|
||||||
drain,
|
drain,
|
||||||
spawn_all,
|
spawn_all,
|
||||||
|
|||||||
Reference in New Issue
Block a user