mirror of https://github.com/rwf2/Rocket.git
Impl 'Deref' to 'Request' for 'LocalRequest'.
This commit is contained in:
parent
671246e90c
commit
5977fe1236
|
@ -132,3 +132,11 @@ impl std::fmt::Debug for LocalRequest<'_> {
|
|||
self._request().fmt(f)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'c> std::ops::Deref for LocalRequest<'c> {
|
||||
type Target = Request<'c>;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
self.inner()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -71,3 +71,11 @@ impl std::fmt::Debug for LocalRequest<'_> {
|
|||
self._request().fmt(f)
|
||||
}
|
||||
}
|
||||
|
||||
impl<'c> std::ops::Deref for LocalRequest<'c> {
|
||||
type Target = Request<'c>;
|
||||
|
||||
fn deref(&self) -> &Self::Target {
|
||||
self.inner()
|
||||
}
|
||||
}
|
||||
|
|
|
@ -3,6 +3,9 @@ macro_rules! pub_request_impl {
|
|||
{
|
||||
/// Retrieves the inner `Request` as seen by Rocket.
|
||||
///
|
||||
/// Note that no routing has occurred and that there is no remote
|
||||
/// connection.
|
||||
///
|
||||
/// # Example
|
||||
///
|
||||
/// ```rust
|
||||
|
@ -240,5 +243,8 @@ macro_rules! pub_request_impl {
|
|||
fn _ensure_impls_exist() {
|
||||
fn is_clone_debug<T: Clone + std::fmt::Debug>() {}
|
||||
is_clone_debug::<Self>();
|
||||
|
||||
fn is_deref_req<'a, T: std::ops::Deref<Target = Request<'a>>>() {}
|
||||
is_deref_req::<Self>();
|
||||
}
|
||||
}}
|
||||
|
|
Loading…
Reference in New Issue