Trait shuttle_service::Service

source ·
pub trait Service: 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§

source

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 you Shuttle subdomain (or custom domain). Binding to the address is only relevant if this service is an HTTP server.

Implementors§