[−][src]Struct ringbahn::Cancellation
A cancellation callback to clean up resources when IO gets cancelled.
When a user cancels interest in an event, the future representing that event needs to be dropped. However, that future may share ownership of some data structures (like buffers) with the kernel, which is completing the event. The cancellation callback will take ownership of those resources, and clean them up when it is dropped.
Implementations
impl Cancellation
[src]
pub unsafe fn new(
data: *mut (),
metadata: usize,
drop: unsafe fn(_: *mut (), _: usize)
) -> Cancellation
[src]
data: *mut (),
metadata: usize,
drop: unsafe fn(_: *mut (), _: usize)
) -> Cancellation
Construct a new cancellation callback to hold resources until the event concludes. The
drop
argument will be called recieve the data
and metadata
fields when the
cancellation is dropped.
Safety
When this cancellation is dropped, it will call the drop
closure, which is an unsafe
function. Therefore, whatever invariants are necessary to safely call drop
(such as
exclusive ownership of some heap allocated data) must met when the cancellation is dropped
as well.
It must be safe to send the Cancellation type and references to it between threads.
pub fn null() -> Cancellation
[src]
Construct a null cancellation, which does nothing when it is dropped.
Trait Implementations
Auto Trait Implementations
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, 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>,