Skip to main content

field_size

Macro field_size 

Source
macro_rules! field_size {
    ($t:ty, $f:ident) => { ... };
}
Expand description

Return the size in bytes of a single field within a struct.

This is the field-level counterpart of std::mem::size_of::<T>(). The size is derived from the struct layout produced by bindgen, so it stays in sync with the kernel headers automatically.

use btrfs_uapi::field_size;
use btrfs_uapi::raw::btrfs_root_item;

assert_eq!(field_size!(btrfs_root_item, uuid), 16);