Move generated functions under their corresponding items.

- fn serve -> Service::serve
- fn new_stub -> Client::new

This allows the generated function names to remain consistent across
service definitions while preventing collisions.
This commit is contained in:
Tim Kuehn
2019-07-30 20:13:32 -07:00
parent 2f24842b2d
commit 1b58914d59
12 changed files with 155 additions and 144 deletions

View File

@@ -46,16 +46,15 @@ impl<T> Deadline<T> {
}
impl<T> Future for Deadline<T>
where
T: TryFuture,
T: Future,
{
type Output = Result<T::Ok, timeout::Error<T::Error>>;
type Output = Result<T::Output, timeout::Error<()>>;
fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Self::Output> {
// First, try polling the future
match self.as_mut().future().try_poll(cx) {
Poll::Ready(Ok(v)) => return Poll::Ready(Ok(v)),
match self.as_mut().future().poll(cx) {
Poll::Ready(v) => return Poll::Ready(Ok(v)),
Poll::Pending => {}
Poll::Ready(Err(e)) => return Poll::Ready(Err(timeout::Error::inner(e))),
}
let delay = self.delay().poll_unpin(cx);