pub struct VoteCountingThreadPool<'scope, I, R> {
pool: ThreadPool<'scope, VoteAccumulator<I, R>>,
keep_factors: Arc<RwLock<Vec<R>>>,
}Expand description
A thread pool tied to a scope, that can perform vote counting rounds.
Fields§
§pool: ThreadPool<'scope, VoteAccumulator<I, R>>Inner thread pool.
keep_factors: Arc<RwLock<Vec<R>>>Storage for the keep factors, used as input of the current round by the worker threads.
Implementations§
Source§impl<'scope, I, R> VoteCountingThreadPool<'scope, I, R>
impl<'scope, I, R> VoteCountingThreadPool<'scope, I, R>
Sourcepub fn new<'env>(
thread_scope: &'scope Scope<'scope, 'env>,
num_threads: NonZeroUsize,
range_strategy: RangeStrategy,
election: &'env Election,
pascal: Option<&'env [Vec<I>]>,
) -> Self
pub fn new<'env>( thread_scope: &'scope Scope<'scope, 'env>, num_threads: NonZeroUsize, range_strategy: RangeStrategy, election: &'env Election, pascal: Option<&'env [Vec<I>]>, ) -> Self
Creates a new pool tied to the given scope, with the given number of threads and references to the necessary election inputs.
Sourcepub fn accumulate_votes(&self, keep_factors: &[R]) -> VoteAccumulator<I, R>
pub fn accumulate_votes(&self, keep_factors: &[R]) -> VoteAccumulator<I, R>
Accumulates votes from the election ballots based on the given keep factors.
Auto Trait Implementations§
impl<'scope, I, R> !Freeze for VoteCountingThreadPool<'scope, I, R>
impl<'scope, I, R> !RefUnwindSafe for VoteCountingThreadPool<'scope, I, R>
impl<'scope, I, R> !Send for VoteCountingThreadPool<'scope, I, R>
impl<'scope, I, R> !Sync for VoteCountingThreadPool<'scope, I, R>
impl<'scope, I, R> Unpin for VoteCountingThreadPool<'scope, I, R>
impl<'scope, I, R> !UnwindSafe for VoteCountingThreadPool<'scope, I, R>
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> 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