pub struct Sequential;Expand description
A sequential execution strategy.
This strategy executes all operations on the current thread without any parallelism. It is useful for:
- Debugging and testing (deterministic execution)
no_stdenvironments where threading is unavailable- Small workloads where parallelism overhead exceeds benefits
- Comparing sequential vs parallel performance
§Examples
use commonware_parallel::{Strategy, Sequential};
let strategy = Sequential;
let data = vec![1, 2, 3, 4, 5];
let sum = strategy.fold(&data, || 0, |a, &b| a + b, |a, b| a + b);
assert_eq!(sum, 15);Trait Implementations§
Source§impl Clone for Sequential
impl Clone for Sequential
Source§fn clone(&self) -> Sequential
fn clone(&self) -> Sequential
Returns a duplicate 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 Sequential
impl Debug for Sequential
Source§impl Default for Sequential
impl Default for Sequential
Source§fn default() -> Sequential
fn default() -> Sequential
Returns the “default value” for a type. Read more
Source§impl Strategy for Sequential
impl Strategy for Sequential
Source§fn fold_init<I, INIT, T, R, ID, F, RD>(
&self,
iter: I,
init: INIT,
identity: ID,
fold_op: F,
_reduce_op: RD,
) -> R
fn fold_init<I, INIT, T, R, ID, F, RD>( &self, iter: I, init: INIT, identity: ID, fold_op: F, _reduce_op: RD, ) -> R
Reduces a collection to a single value with per-partition initialization. Read more
Source§fn fold<I, R, ID, F, RD>(
&self,
iter: I,
identity: ID,
fold_op: F,
reduce_op: RD,
) -> R
fn fold<I, R, ID, F, RD>( &self, iter: I, identity: ID, fold_op: F, reduce_op: RD, ) -> R
Reduces a collection to a single value using fold and reduce operations. Read more
Source§fn map_collect_vec<I, F, T>(&self, iter: I, map_op: F) -> Vec<T>
fn map_collect_vec<I, F, T>(&self, iter: I, map_op: F) -> Vec<T>
Maps each element and collects results into a
Vec. Read moreSource§fn map_init_collect_vec<I, INIT, T, F, R>(
&self,
iter: I,
init: INIT,
map_op: F,
) -> Vec<R>
fn map_init_collect_vec<I, INIT, T, F, R>( &self, iter: I, init: INIT, map_op: F, ) -> Vec<R>
Maps each element with per-partition state and collects results into a
Vec. Read moreAuto Trait Implementations§
impl Freeze for Sequential
impl RefUnwindSafe for Sequential
impl Send for Sequential
impl Sync for Sequential
impl Unpin for Sequential
impl UnwindSafe for Sequential
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