pub struct RealTime { /* private fields */ }Expand description
Real-time implementation that delegates to tokio.
Uses tokio::time::Instant for time tracking to ensure consistency with
tokio::time::sleep(). This is important for tests using start_paused = true
where tokio’s virtual time is used - using std::time::Instant would cause
timing loops to run much longer than expected because wall-clock time doesn’t
advance with paused tokio time.
Implementations§
Trait Implementations§
Source§impl TimeSource for RealTime
impl TimeSource for RealTime
Source§fn supports_keepalive(&self) -> bool
fn supports_keepalive(&self) -> bool
Disable keepalive when SimulationTransportOpt is enabled.
The direct runner uses RealTime (with start_paused(true)) rather than
VirtualTime for connections, so keepalive is enabled by default. But in
large-scale simulations, connections never actually drop, and 15K keepalive
tasks pinging every 5 seconds creates enormous scheduling overhead.
This is opt-in via SimulationTransportOpt::enable() so that tests which
need keepalive behavior (e.g., connection timeout tests) can leave it off.
Source§fn sleep(&self, duration: Duration) -> Pin<Box<dyn Future<Output = ()> + Send>>
fn sleep(&self, duration: Duration) -> Pin<Box<dyn Future<Output = ()> + Send>>
Source§fn sleep_until(
&self,
deadline_nanos: u64,
) -> Pin<Box<dyn Future<Output = ()> + Send>>
fn sleep_until( &self, deadline_nanos: u64, ) -> Pin<Box<dyn Future<Output = ()> + Send>>
Source§fn timeout<F, T>(
&self,
duration: Duration,
future: F,
) -> Pin<Box<dyn Future<Output = Option<T>> + Send>>
fn timeout<F, T>( &self, duration: Duration, future: F, ) -> Pin<Box<dyn Future<Output = Option<T>> + Send>>
Source§fn connection_idle_timeout(&self) -> Duration
fn connection_idle_timeout(&self) -> Duration
Auto Trait Implementations§
impl Freeze for RealTime
impl RefUnwindSafe for RealTime
impl Send for RealTime
impl Sync for RealTime
impl Unpin for RealTime
impl UnsafeUnpin for RealTime
impl UnwindSafe for RealTime
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
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>
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>
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