pub struct Server<S, L> { /* private fields */ }Implementations§
source§impl<S, L> Server<S, L>
impl<S, L> Server<S, L>
sourcepub fn register_shutdown_hook(
self,
hook: impl FnOnce() -> BoxFuture<'static, ()> + 'static + Send
) -> Self
pub fn register_shutdown_hook( self, hook: impl FnOnce() -> BoxFuture<'static, ()> + 'static + Send ) -> Self
Register shutdown hook.
Hook functions will be called just before volo’s own gracefull existing code starts, in reverse order of registration.
sourcepub fn layer<Inner>(self, layer: Inner) -> Server<S, Stack<Inner, L>>
pub fn layer<Inner>(self, layer: Inner) -> Server<S, Stack<Inner, L>>
Adds a new inner layer to the server.
The layer’s Service should be Send + Sync + Clone + 'static.
Order
Assume we already have two layers: foo and bar. We want to add a new layer baz.
The current order is: foo -> bar (the request will come to foo first, and then bar).
After we call .layer(baz), we will get: foo -> bar -> baz.
sourcepub fn layer_front<Front>(self, layer: Front) -> Server<S, Stack<L, Front>>
pub fn layer_front<Front>(self, layer: Front) -> Server<S, Stack<L, Front>>
Adds a new front layer to the server.
The layer’s Service should be Send + Sync + Clone + 'static.
Order
Assume we already have two layers: foo and bar. We want to add a new layer baz.
The current order is: foo -> bar (the request will come to foo first, and then bar).
After we call .layer_front(baz), we will get: baz -> foo -> bar.