udev

Trait AsRawWithContext

source
pub trait AsRawWithContext<T: 'static> {
    // Required methods
    fn as_raw(&self) -> *mut T;
    fn udev(&self) -> &Udev;
    fn into_raw_with_context(self) -> (*mut udev, *mut T);
}
Expand description

Receive the underlying raw pointer for types with an associated udev struct which must outlive them.

Required Methods§

source

fn as_raw(&self) -> *mut T

Get a reference of the underlying struct.

The reference count will not be increased.

source

fn udev(&self) -> &Udev

The udev context with which this struct was created. This must live at least as long as the struct itself or undefined behavior will result.

source

fn into_raw_with_context(self) -> (*mut udev, *mut T)

Convert the object into the raw udev pointer and the underlying pointer for this object.

You are responsible for freeing both. You’re also responsible for ensuring that the udev pointer is not freed until after this object’s pointer is freed.

Implementors§