pub struct MockHandles {
pub http: Option<Arc<MockHttpClient>>,
pub clock: Option<Arc<MockClock>>,
pub rng: Option<Arc<MockRng>>,
}Expand description
Handles to mock dependencies for test inspection and control.
Returned by SteamClientBuilder::build_with_mocks().
These handles allow you to:
MockHttpClient: Queue responses and inspect recorded requests.MockClock: Advance time manually to test timeouts and heartbeats.MockRng: Control random values for deterministic testing.
Fields§
§http: Option<Arc<MockHttpClient>>Mock HTTP client, if configured with
SteamClientBuilder::with_mock_http.
clock: Option<Arc<MockClock>>Mock clock, if configured with SteamClientBuilder::with_mock_clock.
rng: Option<Arc<MockRng>>Mock RNG, if configured with SteamClientBuilder::with_mock_rng.
Implementations§
Source§impl MockHandles
impl MockHandles
Sourcepub fn http_or_panic(&self) -> &MockHttpClient
pub fn http_or_panic(&self) -> &MockHttpClient
Get the mock HTTP client or panic.
§Panics
Panics if no mock HTTP client was configured with
SteamClientBuilder::with_mock_http.
Sourcepub fn clock_or_panic(&self) -> &MockClock
pub fn clock_or_panic(&self) -> &MockClock
Get the mock clock or panic.
§Panics
Panics if no mock clock was configured with
SteamClientBuilder::with_mock_clock.
Sourcepub fn rng_or_panic(&self) -> &MockRng
pub fn rng_or_panic(&self) -> &MockRng
Get the mock RNG or panic.
§Panics
Panics if no mock RNG was configured with
SteamClientBuilder::with_mock_rng.
Trait Implementations§
Source§impl Clone for MockHandles
impl Clone for MockHandles
Source§fn clone(&self) -> MockHandles
fn clone(&self) -> MockHandles
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 Freeze for MockHandles
impl !RefUnwindSafe for MockHandles
impl Send for MockHandles
impl Sync for MockHandles
impl Unpin for MockHandles
impl UnsafeUnpin for MockHandles
impl !UnwindSafe for MockHandles
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more