Trait FromRawWithContext

Source
pub trait FromRawWithContext<T: 'static> {
    // Required method
    unsafe fn from_raw_with_context(udev: *mut udev, ptr: *mut T) -> Self;
}
Expand description

Convert from a raw pointer for types which must be associated with a Udev context object.

Required Methods§

Source

unsafe fn from_raw_with_context(udev: *mut udev, ptr: *mut T) -> Self

Create an object from a given raw pointer and udev context pointer.

The reference count will not be increased, be sure not to free this pointer.

§Safety

The udev pointer must correspond to the udev pointer used when ptr was created. If not memory corruption and undefined behavior will result.

Both the udev and ptr pointers must be a valid reference to the expected underlying udev-struct or undefined behaviour might occur. Do NOT attempt to free either pointer; udev_unref and the corresponding *_unref function for ptr will be called automatically when this type is dropped.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl FromRawWithContext<udev_device> for Device

Source§

impl FromRawWithContext<udev_enumerate> for Enumerator

Source§

impl FromRawWithContext<udev_monitor> for Builder