logo
pub trait Service: Send + Sync {
    fn bind(&mut self, addr: SocketAddr) -> Result<ServeHandle, Error>;

    fn build<'life0, 'life1, 'async_trait>(
        &'life0 mut self,
        __arg1: &'life1 mut dyn Factory,
        _logger: Box<dyn Log>
    ) -> Pin<Box<dyn Future<Output = Result<(), Error>> + Send + 'async_trait>>
    where
        'life0: 'async_trait,
        'life1: 'async_trait,
        Self: 'async_trait
, { ... } }
Expand description

The core trait of the shuttle platform. Every crate deployed to shuttle needs to implement this trait.

Use the declare_service! macro to expose your implementation to the deployment backend.

Required Methods

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.

Provided Methods

This function is run exactly once on each instance of a deployment, prior to calling bind.

The passed Factory can be used to configure additional resources (like databases). And the logger is for logging all runtime events

The default is a noop that returns Ok(()).

Implementors