pub trait FromRaw<T> {
// Required method
unsafe fn from_raw(ffi: *mut T, context: &Libinput) -> Self;
}
Expand description
Trait for types that allow to be initialized from a raw pointer
Required Methods§
Sourceunsafe fn from_raw(ffi: *mut T, context: &Libinput) -> Self
unsafe fn from_raw(ffi: *mut T, context: &Libinput) -> Self
Create a new instance of this type from a raw pointer and it’s context. If the type of the struct is a valid libinput type, but is unknown to this library, it panics instead.
§Warning
If you make use of Userdata
make sure you use the correct types
to allow receiving the set userdata. When dealing with raw pointers initialized by other
libraries this must be done extra carefully to select a correct representation.
If unsure using ()
is always a safe option..
§Safety
If the pointer is pointing to a different struct, invalid memory or NULL
the returned
struct may panic on use or cause other undefined behavior.
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.