pub fn size_of<T>() -> u64 
Expand description

Returns the size of a generic type T in bytes.

Returns

  • [u64] - The size of T in bytes.

Examples

use std::intrinsics::size_of;

fn foo() {
    assert(size_of::<u64>() == 8);
}
use std::intrinsics::size_of;

pub struct Foo {
    a: u64,
    b: u64,
}

fn foo() {
    assert(size_of::<Foo>() == 16);
}