trident 0.2.1

A struct that stores a `T`, either inline or, if `T` is larger than 3 words, allocated
Documentation
1
2
3
4
5
6
7
8
9
use std::mem;

pub(crate) const NWORDS: usize = 3;

pub(crate) const SIZE_LIMIT: usize = mem::size_of::<[usize; NWORDS]>();

pub(crate) fn should_inline<T>() -> bool {
    mem::size_of::<T>() <= SIZE_LIMIT
}