Skip to content

Commit

Permalink
docs(tower): Added intellisense docs
Browse files Browse the repository at this point in the history
  • Loading branch information
ethanholz committed May 12, 2023
1 parent 1183956 commit 08771b5
Showing 1 changed file with 32 additions and 1 deletion.
33 changes: 32 additions & 1 deletion services/shuttle-tower/src/lib.rs
Expand Up @@ -83,5 +83,36 @@ where
}
}

/// The return type that should be returned from the [shuttle_runtime::main] function.
/// Shuttle service return type for the Tower framework.
/// ## Example
/// ```rust,no_run
/// # use std::convert::Infallible;
/// # use std::future::Future;
/// # use std::pin::Pin;
/// # use std::task::{Context, Poll};
/// # #[derive(Clone)]
/// # struct HelloWorld;
/// # impl tower::Service<hyper::Request<hyper::Body>> for HelloWorld {
/// # type Response = hyper::Response<hyper::Body>;
/// # type Error = Infallible;
/// # type Future = Pin<Box<dyn Future<Output = Result<Self::Response, Self::Error>> + Send + Sync>>;
/// # fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll<Result<(), Self::Error>> {
/// # Poll::Ready(Ok(()))
/// # }
/// # fn call(&mut self, _req: hyper::Request<hyper::Body>) -> Self::Future {
/// # let body = hyper::Body::from("Hello, world!");
/// # let resp = hyper::Response::builder()
/// # .status(200)
/// # .body(body)
/// # .expect("Unable to create the `hyper::Response` object");
/// # let fut = async { Ok(resp) };
/// # Box::pin(fut)
/// # }
/// # }
/// # #[shuttle_runtime::main]
/// async fn tower() -> shuttle_tower::ShuttleTower<HelloWorld> {
/// let service = HelloWorld;
/// Ok(service.into())
/// }
/// ```
pub type ShuttleTower<T> = Result<TowerService<T>, Error>;

0 comments on commit 08771b5

Please sign in to comment.