Struct r3_core::kernel::hook::StartupHookDefiner
source · pub struct StartupHookDefiner<System> { /* private fields */ }
Expand description
The definer (static builder) for StartupHook
.
Implementations§
source§impl<System: KernelBase> StartupHookDefiner<System>
impl<System: KernelBase> StartupHookDefiner<System>
sourcepub const fn start<C: IntoClosureConst>(self, start: C) -> Self
pub const fn start<C: IntoClosureConst>(self, start: C) -> Self
[Required] Specify the entry point.
sourcepub const fn priority(self, priority: i32) -> Self
pub const fn priority(self, priority: i32) -> Self
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) -> Self
pub const unsafe fn unchecked(self) -> Self
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: CfgBase<System = System>>(
self,
cfg: &mut Cfg<'_, C>
) -> StartupHook<System>
pub const fn finish<C: CfgBase<System = System>>( self, cfg: &mut Cfg<'_, C> ) -> StartupHook<System>
Complete the registration of a startup hook, returning an StartupHook
object.