Struct prost_twirp::HyperServer
source · pub struct HyperServer<T: HyperService + Send + Sync + 'static> {
pub service: Arc<T>,
}
Expand description
A wrapper for a HyperService trait that keeps a Arc version of the service.
This layer checkcs preconditions of the request (the method and content type) and translates any errors into the Twirp json format.
TODO: Perhaps a clearer name indicating this is a layer?
TODO: Perhaps change to a Tower Layer
, although that would require
another dependency on tower_layer
.
Fields§
§service: Arc<T>
The Arc
version of the service
Needed because of hyper Service lifetimes
Implementations§
source§impl<T: HyperService + Send + Sync + 'static> HyperServer<T>
impl<T: HyperService + Send + Sync + 'static> HyperServer<T>
sourcepub fn new(service: T) -> HyperServer<T>
pub fn new(service: T) -> HyperServer<T>
Create a new service wrapper for the given impl
Trait Implementations§
source§impl<T: 'static + HyperService + Send + Sync> Service<Request<Body>> for HyperServer<T>
impl<T: 'static + HyperService + Send + Sync> Service<Request<Body>> for HyperServer<T>
§type Future = Pin<Box<dyn Future<Output = Result<<HyperServer<T> as Service<Request<Body>>>::Response, <HyperServer<T> as Service<Request<Body>>>::Error>> + Send + 'static, Global>>
type Future = Pin<Box<dyn Future<Output = Result<<HyperServer<T> as Service<Request<Body>>>::Response, <HyperServer<T> as Service<Request<Body>>>::Error>> + Send + 'static, Global>>
The future response value.