MCPcopy Create free account
hub / github.com/FrameworkComputer/framework-system / any_as_u8_slice

Function any_as_u8_slice

framework_lib/src/util.rs:172–175  ·  view source on GitHub ↗

Convert any type to a u8 slice (Like a C byte buffer)

(p: &T)

Source from the content-addressed store, hash-verified

170
171/// Convert any type to a u8 slice (Like a C byte buffer)
172pub unsafe fn any_as_u8_slice<T: Sized>(p: &T) -> &[u8] {
173 let len = ::std::mem::size_of::<T>();
174 ::std::slice::from_raw_parts((p as *const T) as *const u8, len)
175}
176
177/// Convert any type to a mut u8 slice (Like a C byte buffer)
178#[cfg(feature = "rusb")]

Callers 8

format_requestMethod · 0.85
read_mem_via_cmdFunction · 0.85
pack_requestFunction · 0.85
i2c_readFunction · 0.85
i2c_read_16bit_addrFunction · 0.85
i2c_write_blockFunction · 0.85
i2c_writeFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected