Struct dropshot::RequestInfo
source · pub struct RequestInfo { /* private fields */ }
Implementations§
source§impl RequestInfo
impl RequestInfo
pub fn new<B>(request: &Request<B>, remote_addr: SocketAddr) -> Self
source§impl RequestInfo
impl RequestInfo
pub fn method(&self) -> &Method
pub fn uri(&self) -> &Uri
pub fn version(&self) -> Version
pub fn headers(&self) -> &HeaderMap<HeaderValue>
pub fn remote_addr(&self) -> SocketAddr
sourcepub async fn lock(&self) -> &Self
👎Deprecated since 0.9.0: use rqctx.request
directly instead of rqctx.request.lock().await
pub async fn lock(&self) -> &Self
rqctx.request
directly instead of rqctx.request.lock().await
Returns a reference to the RequestInfo
itself
This is provided for source compatibility. In previous versions of
Dropshot, RequestContext.request
was an
Arc<Mutex<hyper::Request<hyper::Body>>>
. Now, it’s just
RequestInfo
, which provides many of the same functions as
hyper::Request
does. Consumers should just use rqctx.request
instead of this function.
For example, in previous versions of Dropshot, you might have:
ⓘ
let request = rqctx.request.lock().await;
let headers = request.headers();
Now, you would do this:
ⓘ
let headers = rqctx.request.headers();
This function allows the older code to continue to work.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for RequestInfo
impl RefUnwindSafe for RequestInfo
impl Send for RequestInfo
impl Sync for RequestInfo
impl Unpin for RequestInfo
impl UnwindSafe for RequestInfo
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