pub struct SmolRuntime;Expand description
The smol runtime: tasks on smol’s global executor, timers and sockets on async-io’s
reactor, name lookups on smol’s thread pool. It needs no setup and can be used from any
thread, inside or outside smol::block_on.
Implementations§
Source§impl SmolRuntime
impl SmolRuntime
Trait Implementations§
Source§impl Clone for SmolRuntime
impl Clone for SmolRuntime
impl Copy for SmolRuntime
Source§impl Debug for SmolRuntime
impl Debug for SmolRuntime
Source§impl Default for SmolRuntime
impl Default for SmolRuntime
Source§impl Runtime for SmolRuntime
impl Runtime for SmolRuntime
Source§fn spawn(&self, future: BoxFuture<'static, ()>) -> Box<dyn JoinHandle>
fn spawn(&self, future: BoxFuture<'static, ()>) -> Box<dyn JoinHandle>
Runs
future as a task of its own. Dropping the handle detaches the task (it runs on);
JoinHandle::abort cancels it.Source§fn now(&self) -> Instant
fn now(&self) -> Instant
The runtime’s clock. Every time the driver gives the engine comes from here, so a
virtual clock drives the engine’s timers too.
Source§fn sleep_until(&self, deadline: Instant) -> BoxFuture<'static, ()>
fn sleep_until(&self, deadline: Instant) -> BoxFuture<'static, ()>
A future that completes once
now has reached deadline (at once when it
has already).Source§fn bind_udp(&self, local: SocketAddr) -> Result<Arc<dyn AsyncUdpSocket>>
fn bind_udp(&self, local: SocketAddr) -> Result<Arc<dyn AsyncUdpSocket>>
A UDP socket bound to
local (port 0: any free port). Read moreSource§fn bind_udp_multicast(
&self,
config: &MulticastConfig,
) -> Result<Arc<dyn AsyncUdpSocket>>
fn bind_udp_multicast( &self, config: &MulticastConfig, ) -> Result<Arc<dyn AsyncUdpSocket>>
A UDP socket joined to a multicast group (mDNS: 224.0.0.251 or ff02::fb on 5353). Read more
Source§fn listen_tcp(
&self,
local: SocketAddr,
reuse_address: bool,
) -> Result<Arc<dyn AsyncTcpListener>>
fn listen_tcp( &self, local: SocketAddr, reuse_address: bool, ) -> Result<Arc<dyn AsyncTcpListener>>
A TCP listener on
local (backlog 128). reuse_address sets SO_REUSEADDR (and
SO_REUSEPORT where the platform has it). Read moreSource§fn connect_tcp(
&self,
local: SocketAddr,
remote: SocketAddr,
reuse_address: bool,
) -> BoxFuture<'static, Result<Arc<dyn AsyncTcpStream>>>
fn connect_tcp( &self, local: SocketAddr, remote: SocketAddr, reuse_address: bool, ) -> BoxFuture<'static, Result<Arc<dyn AsyncTcpStream>>>
A TCP connection from
local (bound first: an ICE-TCP active candidate’s address) to
remote, with TCP_NODELAY set. The driver bounds it with its connect timeout.Source§fn resolve_host(
&self,
host: &str,
port: u16,
) -> BoxFuture<'static, Result<Vec<SocketAddr>>>
fn resolve_host( &self, host: &str, port: u16, ) -> BoxFuture<'static, Result<Vec<SocketAddr>>>
The addresses of
host with port, both families together (the system resolver asks
for AAAA and A at once, RFC 8305 section 3).Source§fn block_on(&self, future: Pin<Box<dyn Future<Output = ()> + '_>>)
fn block_on(&self, future: Pin<Box<dyn Future<Output = ()> + '_>>)
Runs
future to completion on the calling thread. The future need not be Send.Source§fn resolve_family(
&self,
host: &str,
port: u16,
ipv6: bool,
) -> Option<BoxFuture<'static, Vec<SocketAddr>>>
fn resolve_family( &self, host: &str, port: u16, ipv6: bool, ) -> Option<BoxFuture<'static, Vec<SocketAddr>>>
The addresses of one family of
host, when the runtime can ask for AAAA and A apart
(RFC 8305 section 3: the engine starts on the first answer). None, the default: it
cannot, and the driver uses resolve_host.Source§fn resolve_records(
&self,
name: &str,
kind: RecordKind,
) -> BoxFuture<'static, Vec<DnsRecord>>
fn resolve_records( &self, name: &str, kind: RecordKind, ) -> BoxFuture<'static, Vec<DnsRecord>>
The SRV or NAPTR records of
name (RFC 5928, RFC 8489 section 8). The default answers
none, and the engine then uses the host and the scheme’s default port.Source§fn virtual_clock(&self) -> bool
fn virtual_clock(&self) -> bool
Whether
now is a virtual clock (a mock’s) rather than the wall clock.
What is kept per process on the wall clock (the mDNS budget,
process_mdns_rate_limit) is not shared with a
driver on a virtual clock, whose times run elsewhere. false by default.Auto Trait Implementations§
impl Forget for SmolRuntime
impl Freeze for SmolRuntime
impl Move for SmolRuntime
impl RefUnwindSafe for SmolRuntime
impl Send for SmolRuntime
impl Sync for SmolRuntime
impl Unpin for SmolRuntime
impl UnsafeUnpin for SmolRuntime
impl UnwindSafe for SmolRuntime
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
The archived version of the pointer metadata for this type.
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
Converts some archived metadata to the pointer metadata for itself.
Source§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
Source§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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 moreSource§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Returns the layout of the type.
Source§impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
impl<T, N1, N2> Niching<NichedOption<T, N1>> for N2
Source§unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
unsafe fn is_niched(niched: *const NichedOption<T, N1>) -> bool
Returns whether the given value has been niched. Read more
Source§fn resolve_niched(out: Place<NichedOption<T, N1>>)
fn resolve_niched(out: Place<NichedOption<T, N1>>)
Writes data to
out indicating that a T is niched.