shuttle-tower

Crates.ioshuttle-tower
lib.rsshuttle-tower
version0.43.0
sourcesrc
created_at2023-03-14 12:28:45.953473
updated_at2024-04-02 12:27:39.088371
descriptionService implementation to run a tower webserver on shuttle
homepage
repository
max_upload_size
id809812
Jocelyn Boullier (Kazy)

documentation

README

## Shuttle service integration 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> for HelloWorld { type Response = hyper::Response; type Error = Infallible; type Future = Pin> + Send + Sync>>; fn poll_ready(&mut self, _cx: &mut Context<'_>) -> Poll> { Poll::Ready(Ok(())) } fn call(&mut self, _req: hyper::Request) -> 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 { let service = HelloWorld; Ok(service.into()) } ```
Commit count: 0

cargo fmt