Struct r3::kernel::hook::StartupHookDefiner
source · pub struct StartupHookDefiner<System> { /* private fields */ }
Expand description
The definer (static builder) for StartupHook
.
Implementations§
source§impl<System> StartupHookDefiner<System>where
System: KernelBase,
impl<System> StartupHookDefiner<System>where System: KernelBase,
sourcepub const fn start<C>(self, start: C) -> StartupHookDefiner<System>where
C: IntoClosureConst,
pub const fn start<C>(self, start: C) -> StartupHookDefiner<System>where C: IntoClosureConst,
[Required] Specify the entry point.
sourcepub const fn priority(self, priority: i32) -> StartupHookDefiner<System>
pub const fn priority(self, priority: i32) -> StartupHookDefiner<System>
Specify the priority. Defaults to 0
when unspecified.
Startup hooks will execute in the ascending order of priority. Startup hooks with identical priority values will execute in the registration order.
priority
must not be negative. This limitation can be relaxed by
calling Self::unchecked
.
sourcepub const unsafe fn unchecked(self) -> StartupHookDefiner<System>
pub const unsafe fn unchecked(self) -> StartupHookDefiner<System>
Allow the use of a negative priority value.
Safety
Startup hooks with negative priority values can rely on their execution order for memory safety.
sourcepub const fn finish<C>(self, cfg: &mut Cfg<'_, C>) -> StartupHook<System>where
C: CfgBase<System = System>,
pub const fn finish<C>(self, cfg: &mut Cfg<'_, C>) -> StartupHook<System>where C: CfgBase<System = System>,
Complete the registration of a startup hook, returning an StartupHook
object.