Skip to main content

ComponentEntry

Struct ComponentEntry 

Source
#[repr(C)]
pub struct ComponentEntry { pub name: &'static str, pub stage: InitStage, pub init_fn: fn() -> Result<(), ComponentInitError>, pub path: &'static str, pub priority: u32, pub depends_on: &'static [&'static str], }
Expand description

Entry placed in .component_entries by #[init_component].

All fields are 'static because this struct lives in a #[used] static.

§Memory layout

#[repr(C)] ensures a stable layout so the linker-section scan in init_all() can iterate entries with ptr::add(1).

Fields§

§name: &'static str

Function name as written in source — used for dependency resolution.

§stage: InitStage

Lifecycle stage this component belongs to.

§init_fn: fn() -> Result<(), ComponentInitError>

The registered initializer.

§path: &'static str

"file!():fn_name" — for log messages only.

§priority: u32

Lower value = earlier init within the same topological level.

§depends_on: &'static [&'static str]

Names of same-stage functions that must complete before this one.

Implementations§

Source§

impl ComponentEntry

Source

pub const fn new( name: &'static str, stage: InitStage, init_fn: fn() -> Result<(), ComponentInitError>, path: &'static str, priority: u32, depends_on: &'static [&'static str], ) -> Self

Construct a ComponentEntry (usable in const / static contexts).

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

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

Source§

type Error = Infallible

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

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

Performs the conversion.
Source§

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

Source§

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

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

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

Performs the conversion.