pub struct FanTask {
pub name: String,
pub timeout: Option<Duration>,
pub weight: u32,
/* private fields */
}Expand description
A single unit of work in a fan-out/fan-in pattern.
Each FanTask wraps a named async closure that receives shared context
from the fan-out root and returns either a numeric output or an error string.
Fields§
§name: StringHuman-readable name (used in result maps and error messages).
timeout: Option<Duration>Optional per-task timeout. When None, the executor default is used.
weight: u32Task weight used by weighted-sum aggregation (default = 1).
Implementations§
Source§impl FanTask
impl FanTask
Sourcepub fn new<N, F, Fut>(name: N, factory: F) -> Self
pub fn new<N, F, Fut>(name: N, factory: F) -> Self
Create a FanTask from an async factory closure.
The closure accepts the shared context and must return a
Future<Output = Result<i64, String>>.
Sourcepub fn with_timeout(self, timeout: Duration) -> Self
pub fn with_timeout(self, timeout: Duration) -> Self
Set a per-task timeout.
Sourcepub fn with_weight(self, weight: u32) -> Self
pub fn with_weight(self, weight: u32) -> Self
Set the aggregation weight for this task (used with
AggregationStrategy::WeightedSum).
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for FanTask
impl !UnwindSafe for FanTask
impl Freeze for FanTask
impl Send for FanTask
impl Sync for FanTask
impl Unpin for FanTask
impl UnsafeUnpin for FanTask
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more