pub struct InternedCategory { /* private fields */ }Expand description
A binary-stable, transparent representation of fxt::InternedCategory.
Under the C++ ABI, fxt::InternedCategory consists of:
- A reference to
InternedString, represented as a&'static InternedString(8 bytes). - A mutable atomic
u32representing the category’s index (4 bytes). - 4 bytes of padding (implied by alignment rules on 64-bit platforms).
Implementations§
Source§impl InternedCategory
impl InternedCategory
Sourcepub const INVALID_INDEX: u32 = u32::MAX
pub const INVALID_INDEX: u32 = u32::MAX
The index value representing an invalid or unregistered category.
Sourcepub const fn new(label: &'static InternedString) -> Self
pub const fn new(label: &'static InternedString) -> Self
Creates a new InternedCategory from a reference to an InternedString.
Sourcepub fn label(&self) -> &'static InternedString
pub fn label(&self) -> &'static InternedString
Returns a reference to the underlying InternedString.
Sourcepub fn string(&self) -> &'static CStr
pub fn string(&self) -> &'static CStr
Returns the static category name as a safe C string reference.
Sourcepub fn set_index(&self, index: u32, expected: u32)
pub fn set_index(&self, index: u32, expected: u32)
Sets the index for the category if it has the expected previous value. This provides a simple way to prevent re-initialization if RegisterCategories() is called more than once, while also providing a way to override the value. This can be removed once the index can be automatically derived from the section offset when the kernel supports extensible categories.