pub struct Noop;Expand description
A no-op RuntimeKit implementation that never actually executes tasks or I/O
spawn and spawn_blocking drop the work they are handed and return a task which never
completes, so anything built on them never resolves either: awaiting the result of
Runtime::to_socket_addrs on a NoopRuntime waits forever,
and parked rather than spinning, since that is what
simple_block_on does with a future which never wakes.
The Reactor side resolves under any executor, not just Executor::block_on, but only as
far as handing something back: sleep completes immediately, and tcp_connect_addr hands over
a DummyIO without having connected to anything. Using it is where the
waiting starts again — every read, write, flush and close on a DummyIO, and every item of the
stream interval returns, is Poll::Pending forever, and no waker is ever registered, so the
executor cannot even be woken to cancel the task waiting on one.
register is the one to watch: it takes the socket by value and drops it, closing the
descriptor, and hands back a DummyIO in its place. Dropping a NoopRuntime into a test
harness therefore loses the socket, silently.
Trait Implementations§
impl Copy for Noop
impl Eq for Noop
Source§impl Executor for Noop
impl Executor for Noop
Source§type Task<T: Send + 'static> = NTask<T>
type Task<T: Send + 'static> = NTask<T>
Source§impl Ord for Noop
impl Ord for Noop
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Source§impl PartialOrd for Noop
impl PartialOrd for Noop
Source§impl Reactor for Noop
impl Reactor for Noop
Source§type TcpStream = DummyIO
type TcpStream = DummyIO
Source§type Sleep = Ready<()>
type Sleep = Ready<()>
Reactor::sleep)Source§fn register<H: Read + Write + AsSysFd + Send + 'static>(
&self,
_socket: H,
) -> Result<impl AsyncRead + AsyncWrite + Send + Unpin + 'static>
fn register<H: Read + Write + AsSysFd + Send + 'static>( &self, _socket: H, ) -> Result<impl AsyncRead + AsyncWrite + Send + Unpin + 'static>
Source§fn interval(
&self,
_dur: Duration,
) -> impl Stream<Item = Instant> + Send + 'static
fn interval( &self, _dur: Duration, ) -> impl Stream<Item = Instant> + Send + 'static
Source§fn tcp_connect_addr(
&self,
_addr: SocketAddr,
) -> impl Future<Output = Result<Self::TcpStream>> + Send + 'static
fn tcp_connect_addr( &self, _addr: SocketAddr, ) -> impl Future<Output = Result<Self::TcpStream>> + Send + 'static
impl RuntimeKit for Noop
impl StructuralPartialEq for Noop
Auto Trait Implementations§
impl Freeze for Noop
impl RefUnwindSafe for Noop
impl Send for Noop
impl Sync for Noop
impl Unpin for Noop
impl UnsafeUnpin for Noop
impl UnwindSafe for Noop
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<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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