Function tower::util::option_layer [−][src]
Expand description
Convert an Option<Layer>
into a Layer
.
use tower::util::option_layer;
// Layer to apply a timeout if configured
let maybe_timeout = option_layer(timeout.map(TimeoutLayer::new));
ServiceBuilder::new()
.layer(maybe_timeout)
.service(svc);