pub struct HookContext { /* private fields */ }Expand description
Run-scoped context supplied to hooks.
Implementations§
Source§impl HookContext
impl HookContext
Sourcepub fn bind<F: Family>(&self, key: &Key<F>) -> Result<Handle<F>, ErrorReport>
pub fn bind<F: Family>(&self, key: &Key<F>) -> Result<Handle<F>, ErrorReport>
Bind a typed key in the run’s handler table. Fails when the current registration has another family. Dispatches are served and recorded without re-entering hooks.
Sourcepub fn is_streaming(&self) -> bool
pub fn is_streaming(&self) -> bool
Whether the streaming surface is driving this run.
Sourcepub fn scratchpad(&self) -> &Scratchpad
pub fn scratchpad(&self) -> &Scratchpad
Shared run scratchpad.
Sourcepub fn append_entry<T: Serialize>(
&self,
kind: impl Into<String>,
value: &T,
) -> Result<(), Error>
pub fn append_entry<T: Serialize>( &self, kind: impl Into<String>, value: &T, ) -> Result<(), Error>
Serialize and append an entry: an Aside of kind by
Author::rig. A hook that needs the turn puts it in value
(turn). Serialization errors leave entries unchanged. The driver transfers pending entries into
the serializable run at its next step boundary; this is not a disk write.
Entries appended during on_run_settled remain visible locally but are not
transferred into the finished run.
Sourcepub fn entries(&self, kind: &str) -> Vec<Aside>
pub fn entries(&self, kind: &str) -> Vec<Aside>
Clone all entries of kind, including resumed entries and new appends,
in append order. Reading does not consume entries.
Sourcepub fn last_entry(&self, kind: &str) -> Option<Aside>
pub fn last_entry(&self, kind: &str) -> Option<Aside>
Clone the most recent entry of kind, if present.