Hi,

How can I static_assert(expr) or evaluate sizeof(T) at compile time? Having
these operators/keywords, we can optmize or check many code when compiling.
See the following snippet:

fn dump_memory<T>(t : T) {
  ...
  let buff : [u8 * sizeof T] = ....;
  statc_assert (sizeof T < 1024*1024);
  ....
}
_______________________________________________
Rust-dev mailing list
[email protected]
https://mail.mozilla.org/listinfo/rust-dev

Reply via email to