[][src]Struct ringbahn::Cancellation

pub struct Cancellation { /* fields omitted */ }

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]

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

impl Drop for Cancellation[src]

impl Send for Cancellation[src]

impl Sync for Cancellation[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.