pub struct Set(/* private fields */);Expand description
A Set contains an immutable list of names.
It provides order-preserving iteration and set operations, and is cheaply clonable.
Implementations§
Source§impl Set
impl Set
Sourcepub fn from_static_names(names: impl IntoIterator<Item = Vertex>) -> Set
pub fn from_static_names(names: impl IntoIterator<Item = Vertex>) -> Set
Creates from a (short) list of known names.
Sourcepub fn from_stream(stream: BoxVertexStream, hints: Hints) -> Set
pub fn from_stream(stream: BoxVertexStream, hints: Hints) -> Set
Creates from a (lazy) stream of names with hints.
Sourcepub fn from_id_iter_idmap_dag<I>(
iter: I,
map: Arc<dyn IdConvert + Send + Sync>,
dag: Arc<dyn DagAlgorithm + Send + Sync>,
) -> Set
pub fn from_id_iter_idmap_dag<I>( iter: I, map: Arc<dyn IdConvert + Send + Sync>, dag: Arc<dyn DagAlgorithm + Send + Sync>, ) -> Set
Creates from a (lazy) iterator of Ids, an IdMap, and a Dag.
Sourcepub fn from_id_iter_dag<I>(
iter: I,
dag: &(impl DagAlgorithm + IdMapSnapshot),
) -> Result<Set>
pub fn from_id_iter_dag<I>( iter: I, dag: &(impl DagAlgorithm + IdMapSnapshot), ) -> Result<Set>
Creates from a (lazy) iterator of Ids and a struct with snapshot abilities.
Sourcepub fn from_id_set_idmap_dag(
spans: IdSet,
map: Arc<dyn IdConvert + Send + Sync>,
dag: Arc<dyn DagAlgorithm + Send + Sync>,
) -> Set
pub fn from_id_set_idmap_dag( spans: IdSet, map: Arc<dyn IdConvert + Send + Sync>, dag: Arc<dyn DagAlgorithm + Send + Sync>, ) -> Set
Creates from IdSet, [IdMap] and DagAlgorithm.
Callsite must make sure spans, map, dag are using the same Id mappings.
Prefer from_id_set_dag if possible.
Sourcepub fn from_id_set_idmap_dag_order(
spans: IdSet,
map: Arc<dyn IdConvert + Send + Sync>,
dag: Arc<dyn DagAlgorithm + Send + Sync>,
iteration_order: Option<BasicIterationOrder>,
) -> Set
pub fn from_id_set_idmap_dag_order( spans: IdSet, map: Arc<dyn IdConvert + Send + Sync>, dag: Arc<dyn DagAlgorithm + Send + Sync>, iteration_order: Option<BasicIterationOrder>, ) -> Set
Creates from IdSet, [IdMap], DagAlgorithm, and BasicIterationOrder.
Callsite must make sure spans, map, dag are using the same Id mappings.
Sourcepub fn from_id_set_dag(
spans: IdSet,
dag: &(impl DagAlgorithm + IdMapSnapshot),
) -> Result<Self>
pub fn from_id_set_dag( spans: IdSet, dag: &(impl DagAlgorithm + IdMapSnapshot), ) -> Result<Self>
Creates from IdSet and a struct with snapshot abilities.
Callsite must make sure spans, dag are using the same Id mappings.
Sourcepub fn from_id_list_dag(
list: IdList,
dag: &(impl DagAlgorithm + IdMapSnapshot),
) -> Result<Self>
pub fn from_id_list_dag( list: IdList, dag: &(impl DagAlgorithm + IdMapSnapshot), ) -> Result<Self>
Creates from IdList and a struct with snapshot abilities.
Unlike Self::from_id_set_dag, the iteration order of list will be preserved.
Callsite must make sure list, dag are using the same Id mappings.
Sourcepub fn from_evaluate_contains<C>(
evaluate: impl Fn() -> Result<Set> + Send + Sync + 'static,
contains: C,
hints: Hints,
) -> Set
pub fn from_evaluate_contains<C>( evaluate: impl Fn() -> Result<Set> + Send + Sync + 'static, contains: C, hints: Hints, ) -> Set
Creates from a function that evaluates to a Set, and a
contains fast path.
Sourcepub fn from_async_evaluate_contains(
evaluate: Box<dyn Fn() -> BoxFuture<'static, Result<Set>> + Send + Sync>,
contains: Box<dyn for<'a> Fn(&'a MetaSet, &'a Vertex) -> BoxFuture<'a, Result<bool>> + Send + Sync>,
hints: Hints,
) -> Set
pub fn from_async_evaluate_contains( evaluate: Box<dyn Fn() -> BoxFuture<'static, Result<Set>> + Send + Sync>, contains: Box<dyn for<'a> Fn(&'a MetaSet, &'a Vertex) -> BoxFuture<'a, Result<bool>> + Send + Sync>, hints: Hints, ) -> Set
Creates from an async function that evaluates to a Set, and a
async contains fast path.
Sourcepub fn difference(&self, other: &Set) -> Set
pub fn difference(&self, other: &Set) -> Set
Calculates the subset that is only in self, not in other.
Sourcepub fn intersection(&self, other: &Set) -> Set
pub fn intersection(&self, other: &Set) -> Set
Calculates the intersection of two sets.
Sourcepub fn union(&self, other: &Set) -> Set
pub fn union(&self, other: &Set) -> Set
Calculates the union of two sets. Iteration order might get lost.
Sourcepub fn union_preserving_order(&self, other: &Self) -> Self
pub fn union_preserving_order(&self, other: &Self) -> Self
Union, but preserve the iteration order (self first, other next).
Sourcepub fn union_zip(&self, other: &Set) -> Set
pub fn union_zip(&self, other: &Set) -> Set
Similar to union, but without showfast paths, and force a “flatten zip” order.
For example [1,2,3,4].union_zip([5,6]) produces this order: [1,5,2,6,3,4].
Sourcepub fn filter(
&self,
filter_func: Box<dyn Fn(&Vertex) -> BoxFuture<'_, Result<bool>> + Send + Sync + 'static>,
) -> Self
pub fn filter( &self, filter_func: Box<dyn Fn(&Vertex) -> BoxFuture<'_, Result<bool>> + Send + Sync + 'static>, ) -> Self
Filter using the given async function. If filter_func returns true
for a vertex, then the vertex will be taken, other it will be skipped.
Sourcepub async fn to_parents(&self) -> Result<Option<impl Parents>>
pub async fn to_parents(&self) -> Result<Option<impl Parents>>
Convert the set to a graph containing only the vertexes in the set. This can be slow on larger sets.
Sourcepub fn dag(&self) -> Option<Arc<dyn DagAlgorithm + Send + Sync>>
pub fn dag(&self) -> Option<Arc<dyn DagAlgorithm + Send + Sync>>
Obtain the attached dag if available.
Sourcepub fn id_map(&self) -> Option<Arc<dyn IdConvert + Send + Sync>>
pub fn id_map(&self) -> Option<Arc<dyn IdConvert + Send + Sync>>
Obtain the attached IdMap if available.
Sourcepub async fn flatten(&self) -> Result<Set>
pub async fn flatten(&self) -> Result<Set>
Convert the current set into a flat static set so it can be used in some
fast paths. This is useful for some common sets like obsolete() that
might be represented by a complex expression.
By flattening, the iteration order might be lost.
Sourcepub async fn flatten_id(
&self,
id_map: Arc<dyn IdConvert + Send + Sync>,
dag: Arc<dyn DagAlgorithm + Send + Sync>,
) -> Result<Set>
pub async fn flatten_id( &self, id_map: Arc<dyn IdConvert + Send + Sync>, dag: Arc<dyn DagAlgorithm + Send + Sync>, ) -> Result<Set>
Convert this set to a static id set.
By flattening, the iteration order might be lost.
Sourcepub async fn flatten_names(&self) -> Result<Set>
pub async fn flatten_names(&self) -> Result<Set>
Convert this set to a static name set.
Sourcepub fn to_id_set_and_id_map_in_o1(
&self,
) -> Option<(IdSet, Arc<dyn IdConvert + Send + Sync>)>
pub fn to_id_set_and_id_map_in_o1( &self, ) -> Option<(IdSet, Arc<dyn IdConvert + Send + Sync>)>
Converts to (IdSet, IdConvert) pair in O(1). If the underlying set
cannot provide such information in O(1), return None.
Useful if the callsite wants to have random access (ex.pathhistory) and control how to resolve in batches.
Trait Implementations§
Source§impl<'a> From<(LegacyCodeNeedIdAccess, IdSet, &'a AbstractDag<IdDag<IndexedLogStore>, IdMap, IndexedLogDagPath, DagState>)> for Set
impl<'a> From<(LegacyCodeNeedIdAccess, IdSet, &'a AbstractDag<IdDag<IndexedLogStore>, IdMap, IndexedLogDagPath, DagState>)> for Set
Auto Trait Implementations§
impl Freeze for Set
impl !RefUnwindSafe for Set
impl Send for Set
impl Sync for Set
impl Unpin for Set
impl UnsafeUnpin for Set
impl !UnwindSafe for Set
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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