IOContext

Struct IOContext 

Source
pub struct IOContext<C: IOCallback, Q, W> { /* private fields */ }
Expand description

IOContext manages the submission of IO tasks to the underlying driver.

It is generic over the callback type C, the submission queue Q, and the worker type W.

§Channel Selection for W (Worker)

When configuring the IOContext with a worker W (usually a channel sender cb_workers), you should choose the crossfire channel type based on your sharing model:

  • Shared Worker (Multiple Contexts): If you have multiple IOContext instances sharing the same callback worker, use the IOWorkers struct, or pass crossfire::MTx (from mpsc or mpmc channels) with your custom worker implementation. This allows multiple producers (contexts) to send completion events to a single consumer (worker).

  • Single Instance (Dedicated Worker): If you have a single IOContext with its own dedicated callback worker, use crossfire::Tx (from spsc channels). This is more efficient for single-producer scenarios.

  • inline callback: If you have a very light callback logic, you can use Inline

Implementations§

Source§

impl<C: IOCallback, Q, W> IOContext<C, Q, W>
where Q: BlockingRxTrait<IOEvent<C>> + Send + 'static, W: Worker<C> + Send + 'static,

Source

pub fn new( depth: usize, queue: Q, cbs: W, driver_type: Driver, ) -> Result<Arc<Self>, Error>

Source

pub fn get_depth(&self) -> usize

Source

pub fn running_count(&self) -> usize

Auto Trait Implementations§

§

impl<C, Q, W> Freeze for IOContext<C, Q, W>

§

impl<C, Q, W> RefUnwindSafe for IOContext<C, Q, W>

§

impl<C, Q, W> Send for IOContext<C, Q, W>
where Q: Send, W: Send,

§

impl<C, Q, W> Sync for IOContext<C, Q, W>
where Q: Send, W: Send,

§

impl<C, Q, W> Unpin for IOContext<C, Q, W>

§

impl<C, Q, W> UnwindSafe for IOContext<C, Q, W>

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.
Source§

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

Source§

fn vzip(self) -> V