Tiny little crate to determine how large an unnameable type is.
```rust
const C: usize = sizeoffuture!(f());
const D: usize = sizeoftraitimpl!(0u8, std::convert::Into
fn main() { println!("{} {} {} {}", C, D, E, F); }
trait Foo<'a> {} impl<'a> Foo<'a> for () {} ```
You can add your own 'helper' macros which specialize to a specific trait, the same way size_of_future!
works. Popular helpers may be upstreamed to this crate.
std::mem::size_of_val
?size_of_val
can't be used in most const
contexts, since futures can't be constructed at compile time.size_of_val
requires you to have a value; you have to create a future you never poll.size_of_trait_impl!
does not evaluate its arguments at all, and can be used in a const context.
Currently, nightly is required (for feature(type_alias_impl_trait)
).