MCPcopy Create free account
hub / github.com/Ruddle/Fomos / to_bytes

Function to_bytes

bootloader/kernel/src/virtio.rs:15–21  ·  view source on GitHub ↗
(t: &T)

Source from the content-addressed store, hash-verified

13};
14
15pub fn to_bytes<T>(t: &T) -> &[u8] {
16 unsafe {
17 let len = core::intrinsics::size_of_val(t);
18 let ptr: *const u8 = core::intrinsics::transmute(t);
19 core::slice::from_raw_parts(ptr, len)
20 }
21}
22
23const MAX_NUM_QUEUE: usize = 256;
24pub struct Virtio {

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected