2 // pretty-expanded FIXME #23616
6 /// Returns the size of a type
7 pub fn size_of<T>() -> usize {
8 TypeInfo::size_of(None::<T>)
11 /// Returns the size of the type that `val` points to
12 pub fn size_of_val<T>(val: &T) -> usize {
16 pub trait TypeInfo: Sized {
17 fn size_of(_lame_type_hint: Option<Self>) -> usize;
18 fn size_of_val(&self) -> usize;
21 impl<T> TypeInfo for T {
22 /// The size of the type in bytes.
23 fn size_of(_lame_type_hint: Option<T>) -> usize {
27 /// Returns the size of the type of `self` in bytes.
28 fn size_of_val(&self) -> usize {
29 TypeInfo::size_of(None::<T>)