Skip to content

Commit

Permalink
it should build
Browse files Browse the repository at this point in the history
  • Loading branch information
davepacheco committed Jul 1, 2024
1 parent ff6cd9d commit d528a8a
Showing 1 changed file with 15 additions and 8 deletions.
23 changes: 15 additions & 8 deletions nexus/src/app/background/driver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,14 @@ impl Driver {
///
/// This function panics if the `name` or `activator` has previously been
/// passed to a call to this function.
pub fn register(&mut self, taskdef: TaskDefinition) -> TaskName {
pub fn register<N, D>(
&mut self,
taskdef: TaskDefinition<'_, N, D>,
) -> TaskName
where
N: ToString,
D: ToString,
{
let name = taskdef.name.to_string();

// Activation of the background task happens in a separate tokio task.
Expand Down Expand Up @@ -220,19 +227,19 @@ impl Drop for Driver {
/// See [`Driver::register()`] for more on how these fields get used.
pub struct TaskDefinition<'a, N: ToString, D: ToString> {
/// identifier for this task
name: N,
pub name: N,
/// short human-readable summary of this task
description: D,
pub description: D,
/// driver should activate the task if it hasn't run in this long
period: Duration,
pub period: Duration,
/// impl of [`BackgroundTask`] that represents the work of the task
task_impl: Box<dyn BackgroundTask>,
pub task_impl: Box<dyn BackgroundTask>,
/// `OpContext` used for task activations
opctx: OpContext,
pub opctx: OpContext,
/// list of watchers that will trigger activation of this task
watchers: Vec<Box<dyn GenericWatcher>>,
pub watchers: Vec<Box<dyn GenericWatcher>>,
/// an [`Activator]` that will be wired up to activate this task
activator: &'a Activator,
pub activator: &'a Activator,
}

/// Activates a background task
Expand Down

0 comments on commit d528a8a

Please sign in to comment.