Skip to main content

InternedCategory

Struct InternedCategory 

Source
pub struct InternedCategory { /* private fields */ }
Expand description

A binary-stable, transparent representation of fxt::InternedCategory.

Under the C++ ABI, fxt::InternedCategory consists of:

  1. A reference to InternedString, represented as a &'static InternedString (8 bytes).
  2. A mutable atomic u32 representing the category’s index (4 bytes).
  3. 4 bytes of padding (implied by alignment rules on 64-bit platforms).

Implementations§

Source§

impl InternedCategory

Source

pub const INVALID_INDEX: u32 = u32::MAX

The index value representing an invalid or unregistered category.

Source

pub const fn new(label: &'static InternedString) -> Self

Creates a new InternedCategory from a reference to an InternedString.

Source

pub fn label(&self) -> &'static InternedString

Returns a reference to the underlying InternedString.

Source

pub fn string(&self) -> &'static CStr

Returns the static category name as a safe C string reference.

Source

pub fn index(&self) -> u32

Returns the index associated with the category.

Source

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.

Trait Implementations§

Auto Trait Implementations§

§

impl !Freeze for InternedCategory

§

impl RefUnwindSafe for InternedCategory

§

impl Unpin for InternedCategory

§

impl UnsafeUnpin for InternedCategory

§

impl UnwindSafe for InternedCategory

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.