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>
Source§type Future = Pin<Box<dyn Future<Output = Result<<HyperServer<T> as Service<Request<Body>>>::Response, <HyperServer<T> as Service<Request<Body>>>::Error>> + Send>>
type Future = Pin<Box<dyn Future<Output = Result<<HyperServer<T> as Service<Request<Body>>>::Response, <HyperServer<T> as Service<Request<Body>>>::Error>> + Send>>
The future response value.
Auto Trait Implementations§
impl<T> Freeze for HyperServer<T>
impl<T> RefUnwindSafe for HyperServer<T>where
T: RefUnwindSafe,
impl<T> Send for HyperServer<T>
impl<T> Sync for HyperServer<T>
impl<T> Unpin for HyperServer<T>
impl<T> UnsafeUnpin for HyperServer<T>
impl<T> UnwindSafe for HyperServer<T>where
T: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more