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 more