1use ngyn_hyper::HyperApplication;
2use shuttle_runtime::{CustomError, Error};
3use std::net::SocketAddr;
4
5pub type ShuttleApplication = HyperApplication;
6pub struct NgynService(HyperApplication);
7
8#[shuttle_runtime::async_trait]
9impl shuttle_runtime::Service for NgynService {
10 async fn bind(mut self, addr: SocketAddr) -> Result<(), Error> {
13 let _ = self
14 .0
15 .listen(addr)
16 .await
17 .map_err(|err| CustomError::new::<Error>(err.into()))?;
18 Ok(())
19 }
20}
21
22impl From<HyperApplication> for NgynService {
23 fn from(app: HyperApplication) -> Self {
24 Self(app)
25 }
26}
27
28pub type ShuttleNgyn = Result<NgynService, Error>;