Compile time get size of Struct


I am doing something like this:

pub fn sdf_triangle2s_to_u8<'a>(v: &'a Vec<SdfTriangle2>) -> &'a [u8] {
    unsafe { std::slice::from_raw_parts(v.as_ptr() as *const u8, v.len() * ### ) }

The struct has proper repr© - so no worries about layout.

My concern is that I need to put in a value for ###. Now, I could calculate manually, but it would be error prone when I modify the struct and annoying as $@*# to debug (since the first half of the meshes would be there, and the second half would be missing or something).

Question: is there a way to get the compiler to put in the number of bytes a SdfTraingle2 takes?



Resolved:: size_of()