Skip to main content

ShuttleService

Trait ShuttleService 

Source
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§

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 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".

Implementors§

Source§

impl<S, State> Service for RamaService<Transport<S>, State>
where S: Service<State, TcpStream>, State: Clone + Send + Sync + 'static,

Source§

impl<S, State, Response> Service for RamaService<Application<S>, State>
where S: Service<State, Request, Response = Response, Error = Infallible>, Response: IntoResponse + Send + 'static, State: Clone + Send + Sync + 'static,