pub struct WorkerOptions {
pub pipe_buffer_size: usize,
pub max_task_count: usize,
}
Expand description
Options that can be passed to methods in the PipelineBuilder when defining stages.
This implements Default which makes it easier to specify options when defining stages. By default, each worker will be allowed 100 concurrent tasks maximum and the buffer of each pipe is set to 30.
§Examples
use async_pipes::{Pipeline, WorkerOptions};
#[tokio::main]
async fn main() {
let pipeline = Pipeline::builder()
.with_inputs("Pipe", vec![()])
.with_consumer("Pipe", WorkerOptions::default(), |_: ()| async move {
/* ... */
})
.build();
assert!(pipeline.is_ok());
}
Fields§
§pipe_buffer_size: usize
The maximum number of items allowed per pipe before stages have to wait to write more data to the pipe.
max_task_count: usize
The maximum number of tasks that a worker can be concurrently running. Once this number is reached in a worker, the worker will poll for tasks completions before spawning more.
Implementations§
Source§impl WorkerOptions
impl WorkerOptions
Sourcepub fn default_single_task() -> Self
pub fn default_single_task() -> Self
Like the Default implementation, but specifies 1
for WorkerOptions::max_task_count.
Sourcepub fn default_multi_task() -> Self
pub fn default_multi_task() -> Self
Specifies 100
for WorkerOptions::max_task_count and 30
for
WorkerOptions::pipe_buffer_size.
Trait Implementations§
Source§impl Clone for WorkerOptions
impl Clone for WorkerOptions
Source§fn clone(&self) -> WorkerOptions
fn clone(&self) -> WorkerOptions
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for WorkerOptions
impl Debug for WorkerOptions
Source§impl Default for WorkerOptions
impl Default for WorkerOptions
Source§impl Hash for WorkerOptions
impl Hash for WorkerOptions
Source§impl Ord for WorkerOptions
impl Ord for WorkerOptions
Source§fn cmp(&self, other: &WorkerOptions) -> Ordering
fn cmp(&self, other: &WorkerOptions) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for WorkerOptions
impl PartialEq for WorkerOptions
Source§impl PartialOrd for WorkerOptions
impl PartialOrd for WorkerOptions
impl Eq for WorkerOptions
impl StructuralPartialEq for WorkerOptions
Auto Trait Implementations§
impl Freeze for WorkerOptions
impl RefUnwindSafe for WorkerOptions
impl Send for WorkerOptions
impl Sync for WorkerOptions
impl Unpin for WorkerOptions
impl UnwindSafe for WorkerOptions
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more