utf_size_of

Function utf_size_of 

Source
pub const fn utf_size_of<T>() -> usize
where T: Value,
Expand description

Returns the space (in bytes) a value would take up in column/row space

When a constant or rowed value is written, it is stored in the column or row space (respectively). The space taken up in said space does not depend on the data itself and can be determined at compile-time.

ยงExample

#[derive(Default)]
struct SplitU8(u8, u8);

impl Value for SplitU8 {
    type Primitive = u8;
    // ...
}

fn main() {
    assert_eq!(utf_size_of::<u8>(), 1);
    assert_eq!(utf_size_of::<i32>(), 4);
    assert_eq!(utf_size_of::<Vec<u8>>(), 8);
    assert_eq!(utf_size_of::<String>(), 4);
    assert_eq!(utf_size_of::<SplitU8>(), utf_size_of::<u8>());
}