Trait shuttle_runtime::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, Global>>
where Self: 'async_trait;
}Expand description
The core trait of the shuttle platform. Every crate deployed to shuttle needs to implement this trait.
Use the main macro to expose your implementation to the deployment backend.
Required Methods§
sourcefn bind<'async_trait>(
self,
addr: SocketAddr
) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where
Self: 'async_trait,
fn bind<'async_trait>( self, addr: SocketAddr ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait, Global>>where Self: 'async_trait,
This function is run exactly once on each instance of a deployment.
The deployer expects this instance of Service to bind to the passed SocketAddr.