pub struct SkillUseTrace { /* private fields */ }Expand description
Shared, cloneable buffer of skill names, deduplicated, in first-use order.
Deduplicated because — unlike a tool trace, where repetition is signal about
the approach — a skill re-read three times is still one skill, and
Episode::skills is a set-membership question (“was X in play?”).
Implementations§
Source§impl SkillUseTrace
impl SkillUseTrace
pub fn new() -> Self
Sourcepub fn drain(&self) -> Vec<String>
pub fn drain(&self) -> Vec<String>
Take the recorded skills and reset the buffer (call after a run).
Sourcepub fn hook(&self) -> Arc<dyn Hook> ⓘ
pub fn hook(&self) -> Arc<dyn Hook> ⓘ
A Hook that fills this buffer from
Event::Custom { name: "skill.activated", data: {"skill": "<name>"} }.
Event::Custom is the framework’s escape hatch for signals it doesn’t
model natively, which is exactly what skill activation currently is.
Emitting one keeps the host’s skill-injection code from having to hold a
SkillUseTrace handle.
Trait Implementations§
Source§impl Clone for SkillUseTrace
impl Clone for SkillUseTrace
Auto Trait Implementations§
impl Forget for SkillUseTrace
impl Freeze for SkillUseTrace
impl RefUnwindSafe for SkillUseTrace
impl Send for SkillUseTrace
impl Sync for SkillUseTrace
impl Unpin for SkillUseTrace
impl UnsafeUnpin for SkillUseTrace
impl UnwindSafe for SkillUseTrace
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