MCPcopy Create free account
hub / github.com/emberian/evdev / cast_to_bytes

Function cast_to_bytes

src/lib.rs:520–522  ·  view source on GitHub ↗

SAFETY: T must not have any padding or otherwise uninitialized bytes inside of it

(mem: &T)

Source from the content-addressed store, hash-verified

518
519/// SAFETY: T must not have any padding or otherwise uninitialized bytes inside of it
520pub(crate) unsafe fn cast_to_bytes<T: ?Sized>(mem: &T) -> &[u8] {
521 std::slice::from_raw_parts(mem as *const T as *const u8, std::mem::size_of_val(mem))
522}
523
524/// An error type for the `FromStr` implementation for enum-like types in this crate.
525#[derive(Debug, Clone, PartialEq, Eq, Hash)]

Callers 1

write_eventsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…