devela::all

Macro size_of_expr

Source
macro_rules! size_of_expr {
    ($expr: expr) => { ... };
}
Expand description

Returns the size of an expression in bytes.

  • The expression will not be evaluated.
  • This can be used in const contexts.

§Example

async fn f() {
    let x = 1;
    core::future::ready(()).await;
}
const SIZE: usize = size_of_expr!(f());
assert_eq!(SIZE, 2);

§Features

Makes use of unreachable_unchecked if the unsafe_hint feature is enabled.