Skip to main content

ThreadLifecycleContributor

Trait ThreadLifecycleContributor 

Source
pub trait ThreadLifecycleContributor<C: Sync>: Send + Sync {
    // Provided methods
    fn on_thread_start<'a>(
        &'a self,
        input: ThreadStartInput<'a, C>,
    ) -> ExtensionFuture<'a, ()> { ... }
    fn on_thread_resume<'a>(
        &'a self,
        input: ThreadResumeInput<'a>,
    ) -> ExtensionFuture<'a, ()> { ... }
    fn on_thread_idle<'a>(
        &'a self,
        input: ThreadIdleInput<'a>,
    ) -> ExtensionFuture<'a, ()> { ... }
    fn on_thread_stop<'a>(
        &'a self,
        input: ThreadStopInput<'a>,
    ) -> ExtensionFuture<'a, ()> { ... }
}
Expand description

Contributor for host-owned thread lifecycle gates.

Implementations should use these callbacks to seed, rehydrate, or flush extension-private thread state. Heavy dependencies belong on the extension value created by the host, not in these inputs.

Provided Methods§

Source

fn on_thread_start<'a>( &'a self, input: ThreadStartInput<'a, C>, ) -> ExtensionFuture<'a, ()>

Called after host startup has initialized the thread-scoped store.

Source

fn on_thread_resume<'a>( &'a self, input: ThreadResumeInput<'a>, ) -> ExtensionFuture<'a, ()>

Called after the host constructs a runtime from persisted history.

Source

fn on_thread_idle<'a>( &'a self, input: ThreadIdleInput<'a>, ) -> ExtensionFuture<'a, ()>

Called after the host has drained immediately pending thread work.

Implementations may use host capabilities captured by the extension to submit follow-up input. The host remains responsible for deciding whether that input starts a turn, is queued, or is ignored.

Source

fn on_thread_stop<'a>( &'a self, input: ThreadStopInput<'a>, ) -> ExtensionFuture<'a, ()>

Called before the host drops the thread runtime and thread-scoped store.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§