Struct Environment

Source
pub struct Environment;

Implementations§

Source§

impl Environment

Source

pub const ENFORCE_ALLOWED_SCHEDULER_ROLES: u32 = 1u32

Source

pub fn start(options: u32) -> Result<Environment, Status>

Start the driver runtime. This sets up the initial thread that the dispatchers run on.

Source

pub fn new_driver<T>(&self, driver: *const T) -> Driver<T>

Creates a new driver. It is expected that the driver passed in is a leaked pointer which will only be recovered by triggering the shutdown method on the driver.

§Panics

This method will panic if |driver| is not null.

Source

pub fn with_current_driver<R>( f: impl FnOnce(Option<DriverRefTypeErased<'_>>) -> R, ) -> R

Calls |f| with the driver on top of the the thread’s current call stack. If no drivers ar currently on the stack, it will pass in None instead.

Source

pub fn reset(&self)

Resets the driver runtime to zero threads. This may only be called when there are no existing dispatchers.

§Panics

This method should not be called from a thread managed by the driver runtime, such as from tasks or ChannelRead callbacks.

Source

pub fn destroy_all_dispatchers(&self)

Destroys all dispatchers in the process and blocks the current thread until each runtime dispatcher in the process is observed to have been destroyed.

This should only be used called after all drivers have been shutdown.

§Panics

This method should not be called from a thread managed by the driver runtime, such as from tasks or ChannelRead callbacks.

Source

pub fn dispatcher_has_queued_tasks(&self, dispatcher: DispatcherRef<'_>) -> bool

Returns whether the dispatcher has any queued tasks.

Source

pub fn get_thread_limit(&self, scheduler_role: &str) -> u32

Returns the current maximum number of threads which will be spawned for thread pool associated with the given scheduler role.

|scheduler_role| is the name of the role which is passed when creating dispatchers.

Source

pub fn set_thread_limit( &self, scheduler_role: &str, max_threads: u32, ) -> Result<(), Status>

Sets the number of threads which will be spawned for thread pool associated with the given scheduler role. It cannot shrink the limit less to a value lower than the current number of threads in the thread pool.

|scheduler_role| is the name of the role which is passed when creating dispatchers. |max_threads| is the number of threads to use as new limit.

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

Source§

fn from(t: T) -> T

Returns the argument unchanged.

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, 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.