hook
ModuleUndocumented.
Contents
Structs
HookA callback with its groups, params and injections.JobThe handler of one queue: a `Hook` whose init and shutdown hooks can be switched off.ParamA param read from the message payload.ResourcesResources by name, falling back to a parent: the server's resources are the parent of every message's context.ScopeThe arguments a hook's action receives: params by key and injected resources by name, in declaration order.use utopia_queue::Hook;Rust
pub struct HookA callback with its groups, params and injections.
Rust
use utopia_queue::Hook;
let mut hook = Hook::new();
hook.groups(&["emails"]).inject("message").action(|scope| async move {
let _message = scope.message();
Ok(())
});
assert_eq!(hook.group_names(), ["emails"]);use utopia_queue::Job;Rust
pub struct JobThe handler of one queue: a Hook whose init and shutdown hooks can
be switched off.
Also implements
Default, Deref, DerefMut.use utopia_queue::hook::Param;Rust
pub struct ParamA param read from the message payload.
use utopia_queue::hook::Resources;Rust
pub struct ResourcesResources by name, falling back to a parent: the server's resources are the parent of every message's context.
use utopia_queue::hook::Scope;Rust
pub struct ScopeThe arguments a hook's action receives: params by key and injected resources by name, in declaration order.
use utopia_queue::hook::Check;Rust
pub enum CheckA param's validator: an instance, or a factory given injected resources.
Rust
pub type Action = Arc<dyn Fn(Scope) -> BoxFuture<'static, Result<()>> + Send + Sync>A hook's callback.
Rust
pub type Resource = Arc<dyn Any + Send + Sync>An injectable resource.
Rust
pub type ValidatorFactory = Arc<dyn Fn(&[Resource]) -> Arc<dyn Validator> + Send + Sync>Builds a param's validator from its injected resources.