Struct MockConnectInfo
pub struct MockConnectInfo<T>(pub T);
Middleware used to mock ConnectInfo during tests.
If you're accidentally using MockConnectInfo and
Router::into_make_service_with_connect_info at the same time then
Router::into_make_service_with_connect_info takes precedence.
Example
use ;
use SocketAddr;
use ServiceExt;
async
// this router you can run with `app.into_make_service_with_connect_info::<SocketAddr>()`
// use this router for tests
// #[tokio::test]
async
#
#
# async
Fields
0: T
Trait Implementations
impl<S, T> Layer<S> for MockConnectInfo<T>
where
T: Clone + Send + Sync + 'static,
type Service = <Extension<MockConnectInfo<T>> as Layer<S>>::Service;fn layer(&self, inner: S) -> Self::Service
impl<T: Clone> Clone for MockConnectInfo<T>
fn clone(&self) -> MockConnectInfo<T>
impl<T: Copy> Copy for MockConnectInfo<T>
impl<T: Debug> Debug for MockConnectInfo<T>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
Auto Trait Implementations
impl<T> Freeze for MockConnectInfo<T>
where
T: Freeze,
impl<T> RefUnwindSafe for MockConnectInfo<T>
where
T: RefUnwindSafe,
impl<T> Send for MockConnectInfo<T>
where
T: Send,
impl<T> Sync for MockConnectInfo<T>
where
T: Sync,
impl<T> Unpin for MockConnectInfo<T>
where
T: Unpin,
impl<T> UnsafeUnpin for MockConnectInfo<T>
where
T: UnsafeUnpin,
impl<T> UnwindSafe for MockConnectInfo<T>
where
T: UnwindSafe,
Blanket Implementations
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for MockConnectInfo<T>
where
ST: ?Sized,
DT: ?Sized,
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for MockConnectInfo<T>
where
ST: ?Sized,
DT: ?Sized,
impl<T> Any for MockConnectInfo<T>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for MockConnectInfo<T>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for MockConnectInfo<T>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> CloneToUninit for MockConnectInfo<T>
where
T: Clone,
unsafe fn clone_to_uninit(&self, dest: *mut u8)
impl<T> From<T> for MockConnectInfo<T>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> FromRef<T> for MockConnectInfo<T>
where
T: Clone,
fn from_ref(input: &T) -> T
impl<T> Instrument for MockConnectInfo<T>
impl<T> Read<Exclusive, BecauseExclusive> for MockConnectInfo<T>
where
T: ?Sized,
impl<T> Same for MockConnectInfo<T>
type Output = T;
impl<T> ToOwned for MockConnectInfo<T>
where
T: Clone,
type Owned = T;fn to_owned(&self) -> Tfn clone_into(&self, target: &mut T)
impl<T> WithSubscriber for MockConnectInfo<T>
impl<T, U> Into<U> for MockConnectInfo<T>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for MockConnectInfo<T>
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for MockConnectInfo<T>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
impl<V, T> VZip<V> for MockConnectInfo<T>
where
V: MultiLane<T>,
fn vzip(self) -> V