pub struct UnaryRequest<T>{ /* private fields */ }Expand description
A unary request with metadata and a message. This is used by both client and server.
The reason we have our own request type instead of using
http::Request<T> directly is that we want to ensure
that the metadata is always a HeaderMap and the creation
of the request is not containing the URI, method, etc. which
won’t be respected anyway.
Implementations§
Source§impl<T> UnaryRequest<T>
impl<T> UnaryRequest<T>
Sourcepub fn new(message: T) -> Self
pub fn new(message: T) -> Self
Create a new unary request with the given message and empty metadata.
Sourcepub fn metadata_mut(&mut self) -> &mut HeaderMap
pub fn metadata_mut(&mut self) -> &mut HeaderMap
Returns a mutable reference to the metadata.
Sourcepub fn into_parts(self) -> Parts<T>
pub fn into_parts(self) -> Parts<T>
Decomposes the request into its parts.
Sourcepub fn from_parts(parts: Parts<T>) -> Self
pub fn from_parts(parts: Parts<T>) -> Self
Creates a request from its parts.
Sourcepub fn into_message(self) -> T
pub fn into_message(self) -> T
Consumes the request, returning the message.
Trait Implementations§
Source§impl<T> Clone for UnaryRequest<T>
impl<T> Clone for UnaryRequest<T>
Source§fn clone(&self) -> UnaryRequest<T>
fn clone(&self) -> UnaryRequest<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<T> Freeze for UnaryRequest<T>where
T: Freeze,
impl<T> RefUnwindSafe for UnaryRequest<T>where
T: RefUnwindSafe,
impl<T> Send for UnaryRequest<T>
impl<T> Sync for UnaryRequest<T>
impl<T> Unpin for UnaryRequest<T>where
T: Unpin,
impl<T> UnwindSafe for UnaryRequest<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