Enum Flow
#[non_exhaustive]pub enum Flow {
Continue,
Cancel,
}Expand description
Whether a mod claims a cancellable hook.
A mod still told once an earlier one cancelled marks its method #[listener(receive_cancelled)]
and reads the event’s cancelled field, which it may set back to false:
use mod_api::{ClientHost, Flow, Hooks, RenderGuiPreEvent};
#[derive(Default)]
struct Gui;
#[mod_api::horizon_mod]
impl Hooks for Gui {
#[listener(priority = -10, receive_cancelled)]
fn render_gui_pre(&self, _: &dyn ClientHost, event: &mut RenderGuiPreEvent) -> Flow {
event.cancelled = false;
Flow::Continue
}
}A hook no mod can cancel has no cancel to receive, so the option doesn’t compile there:
ⓘ
use mod_api::{ClientHost, ClientTickPreEvent, Hooks};
#[derive(Default)]
struct Ticker;
#[mod_api::horizon_mod]
impl Hooks for Ticker {
#[listener(receive_cancelled)]
fn client_tick_pre(&self, _: &mut dyn ClientHost, _: &mut ClientTickPreEvent) {}
}Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Continue
Go on to the next listener and then the game’s own behaviour.
Cancel
Stop here; the game’s own behaviour does not run.
Trait Implementations§
impl Copy for Flow
impl Eq for Flow
impl StructuralPartialEq for Flow
Auto Trait Implementations§
impl Freeze for Flow
impl RefUnwindSafe for Flow
impl Send for Flow
impl Sync for Flow
impl Unpin for Flow
impl UnsafeUnpin for Flow
impl UnwindSafe for Flow
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