Struct linux_drm::event::UnsupportedDrmEvent
source · pub struct UnsupportedDrmEvent { /* private fields */ }
Expand description
Raw owned representation of a DRM event of a type that this crate doesn’t directly support.
Implementations§
source§impl UnsupportedDrmEvent
impl UnsupportedDrmEvent
pub fn from_raw(raw: &DrmEvent) -> Self
pub fn typ(&self) -> u32
pub fn body_len(&self) -> usize
sourcepub fn body_bytes(&self) -> &[u8] ⓘ
pub fn body_bytes(&self) -> &[u8] ⓘ
Get the body of the event as a raw byte slice.
sourcepub fn body_ptr<T: Sized>(&self) -> *const T
pub fn body_ptr<T: Sized>(&self) -> *const T
Get a pointer to the event body that interprets it as a
value of T
.
Dereferencing the returned pointer is undefined behavior
unless the body is long enough to contain a T
and
contains a valid representation of T
.
sourcepub unsafe fn body_as<T>(&self) -> Option<&T>
pub unsafe fn body_as<T>(&self) -> Option<&T>
Get a reference to the body interpreted as type T
only if the body is at least long enough to fit
a value of that type.
§Safety
Caller must ensure that the raw body is a valid
representation of T
. If all bit patterns are
valid representations of T
then this is always
safe but the result might still be nonsense.
sourcepub unsafe fn body_as_unchecked<T>(&self) -> &T
pub unsafe fn body_as_unchecked<T>(&self) -> &T
Returns a reference to the body interpreted as type T
without checking whether the header’s indicated length
is long enough for that type.
§Safety
Caller must ensure that there’s enough valid memory after
the event header for a T
and that the data there is
a valid representation of T
.
Trait Implementations§
source§impl Clone for UnsupportedDrmEvent
impl Clone for UnsupportedDrmEvent
source§fn clone(&self) -> UnsupportedDrmEvent
fn clone(&self) -> UnsupportedDrmEvent
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreAuto Trait Implementations§
impl Freeze for UnsupportedDrmEvent
impl RefUnwindSafe for UnsupportedDrmEvent
impl Send for UnsupportedDrmEvent
impl Sync for UnsupportedDrmEvent
impl Unpin for UnsupportedDrmEvent
impl UnwindSafe for UnsupportedDrmEvent
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)