pub trait KeySet<K> {
Show 15 methods
// Required methods
fn keys_len(&self) -> usize;
fn for_each_key<F, P>(&self, f: F, retained_hint: P)
where F: FnMut(&K),
P: FnMut(&K) -> bool;
fn retain_keys<F, P, R>(
&mut self,
filter: F,
retained_earlier: P,
remove_count: R
)
where F: FnMut(&K) -> bool,
P: FnMut(&K) -> bool,
R: FnMut() -> usize;
// Provided methods
fn has_par_for_each_key(&self) -> bool { ... }
fn par_for_each_key<F, P>(&self, f: F, retained_hint: P)
where F: Fn(&K) + Sync + Send,
P: Fn(&K) -> bool + Sync + Send { ... }
fn map_each_key<R, M, P>(&self, map: M, retained_hint: P) -> Vec<R>
where M: FnMut(&K) -> R,
P: FnMut(&K) -> bool { ... }
fn par_map_each_key<R, M, P>(&self, map: M, retained_hint: P) -> Vec<R>
where M: Fn(&K) -> R + Sync + Send,
R: Send,
P: Fn(&K) -> bool + Sync + Send { ... }
fn maybe_par_map_each_key<R, M, P>(
&self,
map: M,
retained_hint: P,
use_mt: bool
) -> Vec<R>
where M: Fn(&K) -> R + Sync + Send,
R: Send,
P: Fn(&K) -> bool + Sync + Send { ... }
fn par_retain_keys<F, P, R>(
&mut self,
filter: F,
retained_earlier: P,
remove_count: R
)
where F: Fn(&K) -> bool + Sync + Send,
P: Fn(&K) -> bool + Sync + Send,
R: Fn() -> usize { ... }
fn maybe_par_retain_keys<F, P, R>(
&mut self,
filter: F,
retained_earlier: P,
remove_count: R,
use_mt: bool
)
where F: Fn(&K) -> bool + Sync + Send,
P: Fn(&K) -> bool + Sync + Send,
R: Fn() -> usize { ... }
fn retain_keys_with_indices<IF, F, P, R>(
&mut self,
_index_filter: IF,
filter: F,
retained_earlier: P,
remove_count: R
)
where IF: FnMut(usize) -> bool,
F: FnMut(&K) -> bool,
P: FnMut(&K) -> bool,
R: FnMut() -> usize { ... }
fn par_retain_keys_with_indices<IF, F, P, R>(
&mut self,
_index_filter: IF,
filter: F,
retained_earlier: P,
remove_count: R
)
where IF: Fn(usize) -> bool + Sync + Send,
F: Fn(&K) -> bool + Sync + Send,
P: Fn(&K) -> bool + Sync + Send,
R: Fn() -> usize { ... }
fn maybe_par_retain_keys_with_indices<IF, F, P, R>(
&mut self,
index_filter: IF,
filter: F,
retained_earlier: P,
remove_count: R,
use_mt: bool
)
where IF: Fn(usize) -> bool + Sync + Send,
F: Fn(&K) -> bool + Sync + Send,
P: Fn(&K) -> bool + Sync + Send,
R: Fn() -> usize { ... }
fn into_vec<P>(self, retained_hint: P) -> Vec<K>
where P: FnMut(&K) -> bool,
K: Clone,
Self: Sized { ... }
fn par_into_vec<P>(self, retained_hint: P) -> Vec<K>
where P: Fn(&K) -> bool + Sync + Send,
Self: Sized,
K: Clone + Send { ... }
}
Expand description
A trait for accessing and managing sets of keys (of the type K
) during construction of
fmph::Function
or fmph::GOFunction
.
Required Methods§
sourcefn for_each_key<F, P>(&self, f: F, retained_hint: P)
fn for_each_key<F, P>(&self, f: F, retained_hint: P)
Call f
for each key in the set, using single thread.
If self
doesn’t remember which keys are retained it uses retained_hint
to check this.
sourcefn retain_keys<F, P, R>(
&mut self,
filter: F,
retained_earlier: P,
remove_count: R
)
fn retain_keys<F, P, R>( &mut self, filter: F, retained_earlier: P, remove_count: R )
Retains in self
keys pointed by the filter
and remove the rest, using single thread.
filter
shows the keys to be retained (the result of the function can be unspecified for keys removed earlier),retained_earlier
shows the keys that have not been removed earlier,remove_count
returns number of keys to remove.
Provided Methods§
sourcefn has_par_for_each_key(&self) -> bool
fn has_par_for_each_key(&self) -> bool
Returns true
only if Self::par_for_each_key
can use multiple threads.
sourcefn par_for_each_key<F, P>(&self, f: F, retained_hint: P)
fn par_for_each_key<F, P>(&self, f: F, retained_hint: P)
Multi-threaded version of for_each_key
.
sourcefn map_each_key<R, M, P>(&self, map: M, retained_hint: P) -> Vec<R>
fn map_each_key<R, M, P>(&self, map: M, retained_hint: P) -> Vec<R>
Calls map
for each key in the set, and returns outputs of these calls. Uses single thread.
If self
doesn’t remember which keys are retained it uses retained_hint
to check this.
sourcefn par_map_each_key<R, M, P>(&self, map: M, retained_hint: P) -> Vec<R>
fn par_map_each_key<R, M, P>(&self, map: M, retained_hint: P) -> Vec<R>
Multi-threaded version of map_each_key
.
sourcefn maybe_par_map_each_key<R, M, P>(
&self,
map: M,
retained_hint: P,
use_mt: bool
) -> Vec<R>
fn maybe_par_map_each_key<R, M, P>( &self, map: M, retained_hint: P, use_mt: bool ) -> Vec<R>
Calls either map_each_key
(if use_mt
is false
) or par_map_each_key
(if use_mt
is true
).
sourcefn par_retain_keys<F, P, R>(
&mut self,
filter: F,
retained_earlier: P,
remove_count: R
)
fn par_retain_keys<F, P, R>( &mut self, filter: F, retained_earlier: P, remove_count: R )
Multi-threaded version of retain_keys
.
sourcefn maybe_par_retain_keys<F, P, R>(
&mut self,
filter: F,
retained_earlier: P,
remove_count: R,
use_mt: bool
)
fn maybe_par_retain_keys<F, P, R>( &mut self, filter: F, retained_earlier: P, remove_count: R, use_mt: bool )
Calls either retain_keys
(if use_mt
is false
) or par_retain_keys
(if use_mt
is true
).
sourcefn retain_keys_with_indices<IF, F, P, R>(
&mut self,
_index_filter: IF,
filter: F,
retained_earlier: P,
remove_count: R
)
fn retain_keys_with_indices<IF, F, P, R>( &mut self, _index_filter: IF, filter: F, retained_earlier: P, remove_count: R )
Retains in self
keys pointed by the index_filter
(or filter
if self
does not support index_filter
)
and remove the rest.
Uses single thread.
index_filter
shows indices (consistent withpar_map_each_key
) of keys to be retained,filter
shows the keys to be retained,retained_earlier
shows the keys that have not been removed earlier,remove_count
returns number of keys to remove.
The results of index_filter
and filter
are unspecified for keys removed earlier.
sourcefn par_retain_keys_with_indices<IF, F, P, R>(
&mut self,
_index_filter: IF,
filter: F,
retained_earlier: P,
remove_count: R
)
fn par_retain_keys_with_indices<IF, F, P, R>( &mut self, _index_filter: IF, filter: F, retained_earlier: P, remove_count: R )
Multi-threaded version of retain_keys_with_indices
.
sourcefn maybe_par_retain_keys_with_indices<IF, F, P, R>(
&mut self,
index_filter: IF,
filter: F,
retained_earlier: P,
remove_count: R,
use_mt: bool
)
fn maybe_par_retain_keys_with_indices<IF, F, P, R>( &mut self, index_filter: IF, filter: F, retained_earlier: P, remove_count: R, use_mt: bool )
Calls either retain_keys_with_indices
(if use_mt
is false
) or par_retain_keys_with_indices
(if use_mt
is true
).