mirror of
https://github.com/hl-archive-node/nanoreth.git
synced 2025-12-06 10:59:55 +00:00
feat(tasks) : add docs (#5274)
This commit is contained in:
committed by
GitHub
parent
ddcd4d600e
commit
9fc0e7637f
@ -18,16 +18,19 @@ pub struct TaskExecutorMetrics {
|
||||
}
|
||||
|
||||
impl TaskExecutorMetrics {
|
||||
/// Increments the counter for spawned critical tasks.
|
||||
|
||||
pub(crate) fn inc_critical_tasks(&self) {
|
||||
self.critical_tasks.increment(1);
|
||||
}
|
||||
/// Increments the counter for spawned regular tasks.
|
||||
|
||||
pub(crate) fn inc_regular_tasks(&self) {
|
||||
self.regular_tasks.increment(1);
|
||||
}
|
||||
}
|
||||
|
||||
/// Helper type for increasing counters even if a task fails.
|
||||
/// Helper type for increasing counters even if a task fails
|
||||
pub struct IncCounterOnDrop(Counter);
|
||||
|
||||
impl fmt::Debug for IncCounterOnDrop {
|
||||
@ -37,13 +40,15 @@ impl fmt::Debug for IncCounterOnDrop {
|
||||
}
|
||||
|
||||
impl IncCounterOnDrop {
|
||||
/// Create a new `IncCounterOnDrop`.
|
||||
/// Creates a new instance of `IncCounterOnDrop` with the given counter.
|
||||
pub fn new(counter: Counter) -> Self {
|
||||
IncCounterOnDrop(counter)
|
||||
}
|
||||
}
|
||||
|
||||
impl Drop for IncCounterOnDrop {
|
||||
/// Increment the counter when the instance is dropped.
|
||||
|
||||
fn drop(&mut self) {
|
||||
self.0.increment(1);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user