pub struct HookSlot {
pub programs: Vec<LoadedProgram>,
pub runner: HookFn,
}Expand description
A slot for a single hook point, holding its attached programs and runner.
Fields§
§programs: Vec<LoadedProgram>§runner: HookFnFunction pointer — points to hook_noop when empty,
[hook_has_programs] when programs are attached.
Implementations§
Source§impl HookSlot
impl HookSlot
Sourcepub fn update_runner(&mut self)
pub fn update_runner(&mut self)
Update the runner pointer based on whether programs are present.
Sourcepub fn attach(&mut self, program: LoadedProgram)
pub fn attach(&mut self, program: LoadedProgram)
Attach a program to this slot. Maintains descending priority order.
Sourcepub fn detach(&mut self, name: &str) -> Option<LoadedProgram>
pub fn detach(&mut self, name: &str) -> Option<LoadedProgram>
Detach a program by name. Returns the removed program, if found.
Sourcepub fn has_programs(&self) -> bool
pub fn has_programs(&self) -> bool
Returns true if this slot has programs attached (fast check).
Auto Trait Implementations§
impl Freeze for HookSlot
impl !RefUnwindSafe for HookSlot
impl Send for HookSlot
impl Sync for HookSlot
impl Unpin for HookSlot
impl UnsafeUnpin for HookSlot
impl !UnwindSafe for HookSlot
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more