[−][src]Struct ringbahn::Ring
A low-level primitive for building an IO object on io-uring
Ring is a state machine similar to Submission
, but it is designed to cycle through multiple
IO events submitted to io-uring, rather than representing a single submission. Because of this,
it is more low level, but it is suitable fro building an IO object like a File
on top of
io-uring.
Users writing code on top of Ring
are responsible for making sure that it is correct. For
example, when calling poll
, users must ensure that they are in the proper state to submit
whatever type of IO they would be attempting to submit. Additionally, users should note that
Ring
does not implement Drop
. In order to cancel any ongoing IO, users are responsible for
implementing drop to call cancel properly.
Implementations
impl<D: Drive> Ring<D>
[src]
pub fn new(driver: D) -> Ring<D>
[src]
Construct a new Ring on top of a driver.
pub fn driver(&self) -> &D
[src]
pub fn poll(
self: Pin<&mut Self>,
ctx: &mut Context,
is_eager: bool,
prepare: impl FnOnce(&mut SubmissionQueueEvent)
) -> Poll<Result<usize>>
[src]
self: Pin<&mut Self>,
ctx: &mut Context,
is_eager: bool,
prepare: impl FnOnce(&mut SubmissionQueueEvent)
) -> Poll<Result<usize>>
Poll the ring state machine.
This accepts a callback, prepare
, which prepares an event to be submitted to io-uring.
This callback will only be called once during an iteration of ring's state machine: once an
event has been prepared, until it is completed or cancelled, a single ring instance will
not prepare any additional events.
pub fn cancel(&mut self, cancellation: Cancellation)
[src]
Cancel any ongoing IO with this cancellation.
Users are responsible for ensuring that the cancellation passed would be appropriate to clean up the resources of the running event.
pub fn cancel_pinned(self: Pin<&mut Self>, cancellation: Cancellation)
[src]
Cancel any ongoing IO, but from a pinned reference.
This has the same behavior of as Ring::cancel.
Trait Implementations
Auto Trait Implementations
impl<D> !RefUnwindSafe for Ring<D>
impl<D> Send for Ring<D> where
D: Send,
D: Send,
impl<D> Sync for Ring<D> where
D: Sync,
D: Sync,
impl<D> Unpin for Ring<D> where
D: Unpin,
D: Unpin,
impl<D> !UnwindSafe for Ring<D>
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,