SmolRuntime

Struct SmolRuntime 

Source
pub struct SmolRuntime(/* private fields */);
Available on crate feature smol-runtime only.
Expand description

The Runtime implementation backed by the “async-*” family of crates.

Implementations§

Source§

impl SmolRuntime

Source

pub fn with_executor<E: Into<Arc<Executor<'static>>>>(executor: E) -> Self

Create a SmolRuntime from a potentially Arced statically lifetimed async_executor::Executor, not taking advantage of async_executor::StaticExecutor optimizations.

Source

pub fn with_static_executor(executor: &'static StaticExecutor) -> Self

Create a SmolRuntime from a static reference to an optimized async_executor::StaticExecutor.

Trait Implementations§

Source§

impl Clone for SmolRuntime

Source§

fn clone(&self) -> SmolRuntime

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 Runtime for SmolRuntime

Source§

type Task<O: Send + 'static> = SmolRuntimeTask<O>

The RuntimeTask implementation used by this Runtime.
Source§

type TimeoutError = TimeoutError

The error this Runtime yields when a future times out in a controlled manner.
Source§

type File = File

The I/O object representing an opened asynchronously readable file within this Runtime.
Source§

type AsyncFd = SmolRuntimeAsyncFd

The RuntimeAsyncFd implementation used by this Runtime.
Source§

type Child = SmolRuntimeChild

The RuntimeChild implementation used by this Runtime.
Source§

type SocketBackend = AsyncIoBackend

Available on crate feature vmm-process only.
The hyper_client_sockets::Backend of this Runtime, used by fctools to establish connections over Unix or Firecracker sockets.
Source§

fn spawn_task<F>(&self, future: F) -> Self::Task<F::Output>
where F: Future + Send + 'static, F::Output: Send + 'static,

Spawn a static Send future returning a static Send type onto this Runtime and return its joinable task.
Source§

fn timeout<F>( &self, duration: Duration, future: F, ) -> impl Future<Output = Result<F::Output, Self::TimeoutError>> + Send
where F: Future + Send, F::Output: Send,

Await a Send future returning a Send type, cancelling it after the giving Duration and returning a timeout error.
Source§

fn fs_exists( &self, path: &Path, ) -> impl Future<Output = Result<bool, Error>> + Send

Check if the given Path exists on the filesystem.
Source§

fn fs_remove_file( &self, path: &Path, ) -> impl Future<Output = Result<(), Error>> + Send

Remove the given Path as a file from the filesystem.
Source§

fn fs_create_dir_all( &self, path: &Path, ) -> impl Future<Output = Result<(), Error>> + Send

Recursively create a directory tree at the given Path on the filesystem.
Source§

async fn fs_create_file(&self, path: &Path) -> Result<(), Error>

Create a file at the given Path on the filesystem.
Source§

fn fs_write( &self, path: &Path, content: String, ) -> impl Future<Output = Result<(), Error>> + Send

Write the provided String blob to the given Path on the filesystem.
Source§

fn fs_read_to_string( &self, path: &Path, ) -> impl Future<Output = Result<String, Error>> + Send

Read the contents of the file at the given Path on the filesystem to a String blob.
Source§

fn fs_rename( &self, source_path: &Path, destination_path: &Path, ) -> impl Future<Output = Result<(), Error>> + Send

Rename the provided source Path to the provided destination Path on the filesystem.
Source§

fn fs_remove_dir_all( &self, path: &Path, ) -> impl Future<Output = Result<(), Error>> + Send

Recursively remove the directory and its contents at the given Path on the filesystem.
Source§

async fn fs_copy( &self, source_path: &Path, destination_path: &Path, ) -> Result<(), Error>

Copy the file at the source Path on the filesystem to the destination Path.
Source§

fn fs_chown_all( &self, path: &Path, uid: u32, gid: u32, ) -> impl Future<Output = Result<(), Error>> + Send

Recursively change the ownership of the given Path on the filesystem to the given PAM UID and GID.
Hard-link the given source Path on the filesystem to the given destination Path.
Source§

fn fs_open_file_for_read( &self, path: &Path, ) -> impl Future<Output = Result<Self::File, Error>> + Send

Open the file at the given Path on the filesystem in read-only mode, returning an I/O object used for asynchronously reading its contents.
Source§

fn create_async_fd(&self, fd: OwnedFd) -> Result<Self::AsyncFd, Error>

Create an asynchronous file descriptor from the given OwnedFd, tying it to this Runtime’s I/O reactor.
Source§

fn spawn_process( &self, program: &OsStr, args: &[OsString], stdout: bool, stderr: bool, stdin: bool, ) -> Result<Self::Child, Error>

Spawn a child process asynchronously on this Runtime, using the given program, arguments and flags determining whether the stdout, stderr and stdin pipes are nulled or piped.
Source§

fn run_process( &self, program: &OsStr, args: &[OsString], stdout: bool, stderr: bool, ) -> impl Future<Output = Result<Output, Error>> + Send

Run a child process asynchronously on this Runtime until completion, using the given program, arguments and flags determining whether the stdout and stderr pipes are nulled or piped.

Auto Trait Implementations§

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> IntoRequest<T> for T

Source§

fn into_request(self) -> Request<T>

Wrap the input message T in a tonic::Request
Source§

impl<L> LayerExt<L> for L

Source§

fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>
where L: Layer<S>,

Applies the layer to a service and wraps it in Layered.
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<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