pub trait ShuttleService: Send {
// Required method
fn bind<'async_trait>(
self,
addr: SocketAddr,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
where Self: 'async_trait;
}Expand description
The core trait of the Shuttle platform. Every service deployed to Shuttle needs to implement this trait.
An Into<Service> implementor is what is returned in the shuttle_runtime::main macro
in order to run it on the Shuttle servers.
Required Methods§
Sourcefn bind<'async_trait>(
self,
addr: SocketAddr,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
fn bind<'async_trait>(
self,
addr: SocketAddr,
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>where
Self: 'async_trait,
This function is run exactly once on startup of a deployment.
The passed SocketAddr receives proxied HTTP traffic from your Shuttle subdomain (or custom domain).
Binding to the address is only relevant if this service is an HTTP server.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".