add TagSpecs and alter Parser (#68)
Some checks failed
lint / pre-commit (push) Waiting to run
test / test (macos-latest) (push) Waiting to run
test / test (ubuntu-latest) (push) Waiting to run
test / test (windows-latest) (push) Waiting to run
release / linux (map[runner:ubuntu-22.04 target:aarch64]) (push) Failing after 7s
release / linux (map[runner:ubuntu-22.04 target:armv7]) (push) Failing after 3s
release / linux (map[runner:ubuntu-22.04 target:ppc64le]) (push) Failing after 2s
release / linux (map[runner:ubuntu-22.04 target:s390x]) (push) Failing after 2s
release / linux (map[runner:ubuntu-22.04 target:x86]) (push) Failing after 3s
release / linux (map[runner:ubuntu-22.04 target:x86_64]) (push) Failing after 3s
release / musllinux (map[runner:ubuntu-22.04 target:aarch64]) (push) Failing after 3s
release / musllinux (map[runner:ubuntu-22.04 target:armv7]) (push) Failing after 2s
release / musllinux (map[runner:ubuntu-22.04 target:x86]) (push) Failing after 2s
release / musllinux (map[runner:ubuntu-22.04 target:x86_64]) (push) Failing after 2s
release / sdist (push) Has been cancelled
release / windows (map[runner:windows-latest target:x64]) (push) Has been cancelled
release / windows (map[runner:windows-latest target:x86]) (push) Has been cancelled
release / macos (map[runner:macos-13 target:x86_64]) (push) Has been cancelled
release / macos (map[runner:macos-14 target:aarch64]) (push) Has been cancelled
release / release (push) Has been cancelled

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Josh Thomas 2025-04-19 23:58:59 -05:00 committed by GitHub
parent e59f601596
commit 42d089dcc6
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
51 changed files with 2337 additions and 1127 deletions

View file

@ -68,6 +68,10 @@ impl Worker {
}
}
/// Attempts to execute a task immediately without waiting.
/// Returns an error if the worker's channel is full.
///
/// Best for non-critical tasks where backpressure is desired.
pub fn execute<T>(&self, task: T) -> Result<()>
where
T: Task + 'static,
@ -78,6 +82,10 @@ impl Worker {
.map_err(|e| anyhow::anyhow!("Failed to execute task: {}", e))
}
/// Submits a task asynchronously, waiting if the channel is full.
///
/// Good for tasks that must be processed but where you don't need
/// the result immediately.
pub async fn submit<T>(&self, task: T) -> Result<()>
where
T: Task + 'static,
@ -89,6 +97,10 @@ impl Worker {
.map_err(|e| anyhow::anyhow!("Failed to submit task: {}", e))
}
/// Submits a task and waits for its result.
///
/// Best when you need the output of the task. This method will
/// wait both for space to submit the task and for its completion.
pub async fn wait_for<T>(&self, task: T) -> Result<T::Output>
where
T: Task + 'static,