pub struct ServiceRequest<T: Message> {
pub uri: Uri,
pub method: Method,
pub version: Version,
pub headers: HeaderMap,
pub input: T,
}Expand description
A request with HTTP info and a proto request payload object.
Fields§
§uri: UriThe URI of the original request
When using a client, this will be overridden with the proper URI. It is only valuable for servers.
method: MethodThe request method; should always be POST.
version: VersionThe HTTP version, rarely changed from the default.
headers: HeaderMapThe set of headers
Should always at least have Content-Type. Clients will override Content-Length on serialization.
input: TThe request body as a proto Message, representing the arguments of the proto rpc.
Implementations§
Source§impl<T: Message> ServiceRequest<T>
impl<T: Message> ServiceRequest<T>
Sourcepub fn new(input: T) -> ServiceRequest<T>
pub fn new(input: T) -> ServiceRequest<T>
Create new service request with the given input object
This automatically sets the Content-Type header as application/protobuf.
Sourcepub fn clone_with_input(&self, input: T) -> ServiceRequest<T>
pub fn clone_with_input(&self, input: T) -> ServiceRequest<T>
Copy this request with a different input value
Source§impl<T: Message + Default + 'static> ServiceRequest<T>
impl<T: Message + Default + 'static> ServiceRequest<T>
Sourcepub fn to_hyper_request(&self) -> Result<Request<Body>, ProstTwirpError>
pub fn to_hyper_request(&self) -> Result<Request<Body>, ProstTwirpError>
Serialize into a hyper request.
pub async fn from_hyper_request( req: Request<Body>, ) -> Result<ServiceRequest<T>, ProstTwirpError>
Trait Implementations§
Source§impl<T: Message + Default + 'static> From<T> for ServiceRequest<T>
impl<T: Message + Default + 'static> From<T> for ServiceRequest<T>
Source§fn from(v: T) -> ServiceRequest<T>
fn from(v: T) -> ServiceRequest<T>
Converts to this type from the input type.
Auto Trait Implementations§
impl<T> !Freeze for ServiceRequest<T>
impl<T> RefUnwindSafe for ServiceRequest<T>where
T: RefUnwindSafe,
impl<T> Send for ServiceRequest<T>
impl<T> Sync for ServiceRequest<T>
impl<T> Unpin for ServiceRequest<T>where
T: Unpin,
impl<T> UnsafeUnpin for ServiceRequest<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for ServiceRequest<T>where
T: UnwindSafe,
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