Runtime

Struct Runtime 

Source
pub struct Runtime<RK: RuntimeKit> { /* private fields */ }
Expand description

A full-featured Runtime implementation

Implementations§

Source§

impl<RK: RuntimeKit> Runtime<RK>

Source

pub fn new(kit: RK) -> Self

Create a new Runtime from a RuntimeKit

Source

pub fn to_socket_addrs<A: ToSocketAddrs + Send + 'static>( &self, addrs: A, ) -> SocketAddrsResolver<'_, RK, A>
where <A as ToSocketAddrs>::Iter: Send + 'static,

Asynchronously resolve the given domain name

Source§

impl Runtime<RuntimeParts<AsyncGlobalExecutor, AsyncIO>>

Source

pub fn async_global_executor() -> Self

Create a new SmolRuntime

Source§

impl Runtime<Noop>

Source

pub fn noop() -> Self

Create a new NoopRuntime

Source§

impl Runtime<Smol>

Source

pub fn smol() -> Self

Create a new SmolRuntime

Source§

impl Runtime<Tokio>

Source

pub fn tokio() -> Result<Self>

Create a new TokioRuntime and bind it to this tokio runtime.

Source

pub fn tokio_current() -> Self

Create a new TokioRuntime and bind it to the current tokio runtime by default.

Source

pub fn tokio_with_handle(handle: Handle) -> Self

Create a new TokioRuntime and bind it to the tokio runtime associated to this handle by default.

Source

pub fn tokio_with_runtime(runtime: TokioRT) -> Self

Create a new TokioRuntime and bind it to this tokio runtime.

Trait Implementations§

Source§

impl<RK: Clone + RuntimeKit> Clone for Runtime<RK>

Source§

fn clone(&self) -> Runtime<RK>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<RK: Debug + RuntimeKit> Debug for Runtime<RK>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<RK: RuntimeKit> Executor for Runtime<RK>

Source§

type Task<T: Send + 'static> = <RK as Executor>::Task<T>

The type representing the tasks the are returned when spawning a Future on the executor
Source§

fn block_on<T, F: Future<Output = T>>(&self, f: F) -> T

Block on a future until completion
Source§

fn spawn<T: Send + 'static, F: Future<Output = T> + Send + 'static>( &self, f: F, ) -> Task<Self::Task<T>>

Spawn a future and return a handle to track its completion.
Source§

fn spawn_blocking<T: Send + 'static, F: FnOnce() -> T + Send + 'static>( &self, f: F, ) -> Task<Self::Task<T>>

Convert a blocking task into a future, spawning it on a decicated thread pool
Source§

impl<RK: RuntimeKit> From<RK> for Runtime<RK>

Source§

fn from(kit: RK) -> Self

Converts to this type from the input type.
Source§

impl<RK: RuntimeKit> Reactor for Runtime<RK>

Source§

type TcpStream = <RK as Reactor>::TcpStream

The type representing a TCP stream (after tcp_connect) for this reactor
Source§

fn register<H: Read + Write + AsSysFd + Send + 'static>( &self, socket: H, ) -> Result<impl AsyncRead + AsyncWrite + Send + Unpin + 'static>

Register a synchronous handle, returning an asynchronous one
Source§

fn sleep(&self, dur: Duration) -> impl Future<Output = ()> + Send + 'static

Sleep for the given duration
Source§

fn interval( &self, dur: Duration, ) -> impl Stream<Item = Instant> + Send + 'static

Stream that yields at every given interval
Source§

fn tcp_connect_addr( &self, addr: SocketAddr, ) -> impl Future<Output = Result<Self::TcpStream>> + Send + 'static

Create a TcpStream by connecting to a remote host
Source§

fn tcp_connect<A: AsyncToSocketAddrs + Send>( &self, addrs: A, ) -> impl Future<Output = Result<Self::TcpStream>> + Send
where Self: Sync + Sized,

Create a TcpStream by connecting to a remote host

Auto Trait Implementations§

§

impl<RK> Freeze for Runtime<RK>
where RK: Freeze,

§

impl<RK> RefUnwindSafe for Runtime<RK>
where RK: RefUnwindSafe,

§

impl<RK> Send for Runtime<RK>
where RK: Send,

§

impl<RK> Sync for Runtime<RK>
where RK: Sync,

§

impl<RK> Unpin for Runtime<RK>
where RK: Unpin,

§

impl<RK> UnwindSafe for Runtime<RK>
where RK: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> ErasedDestructor for T
where T: 'static,