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

    fn build(&mut self, _: &mut dyn Factory) -> Result<(), Error> { ... }
}
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).

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

Implementors