pub struct NameSet(/* private fields */);Expand description
A NameSet contains an immutable list of names.
It provides order-preserving iteration and set operations, and is cheaply clonable.
Implementations§
Source§impl NameSet
impl NameSet
Sourcepub fn from_static_names(names: impl IntoIterator<Item = VertexName>) -> NameSet
pub fn from_static_names(names: impl IntoIterator<Item = VertexName>) -> NameSet
Creates from a (short) list of known names.
Sourcepub fn from_iter<I>(iter: I, hints: Hints) -> NameSetwhere
I: IntoIterator<Item = Result<VertexName>> + 'static,
<I as IntoIterator>::IntoIter: Send + Sync,
pub fn from_iter<I>(iter: I, hints: Hints) -> NameSetwhere
I: IntoIterator<Item = Result<VertexName>> + 'static,
<I as IntoIterator>::IntoIter: Send + Sync,
Creates from a (lazy) iterator of names.
Sourcepub fn from_stream(stream: BoxVertexStream, hints: Hints) -> NameSet
pub fn from_stream(stream: BoxVertexStream, hints: Hints) -> NameSet
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>,
) -> NameSet
pub fn from_id_iter_idmap_dag<I>( iter: I, map: Arc<dyn IdConvert + Send + Sync>, dag: Arc<dyn DagAlgorithm + Send + Sync>, ) -> NameSet
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<NameSet>
pub fn from_id_iter_dag<I>( iter: I, dag: &(impl DagAlgorithm + IdMapSnapshot), ) -> Result<NameSet>
Creates from a (lazy) iterator of Ids and a struct with snapshot abilities.
Sourcepub fn from_spans_idmap_dag(
spans: IdSet,
map: Arc<dyn IdConvert + Send + Sync>,
dag: Arc<dyn DagAlgorithm + Send + Sync>,
) -> NameSet
pub fn from_spans_idmap_dag( spans: IdSet, map: Arc<dyn IdConvert + Send + Sync>, dag: Arc<dyn DagAlgorithm + Send + Sync>, ) -> NameSet
Creates from IdSet, [IdMap] and DagAlgorithm.
Sourcepub fn from_spans_dag(
spans: IdSet,
dag: &(impl DagAlgorithm + IdMapSnapshot),
) -> Result<Self>
pub fn from_spans_dag( spans: IdSet, dag: &(impl DagAlgorithm + IdMapSnapshot), ) -> Result<Self>
Creates from IdSet and a struct with snapshot abilities.
Sourcepub fn from_evaluate_contains<C>(
evaluate: impl Fn() -> Result<NameSet> + Send + Sync + 'static,
contains: C,
hints: Hints,
) -> NameSet
pub fn from_evaluate_contains<C>( evaluate: impl Fn() -> Result<NameSet> + Send + Sync + 'static, contains: C, hints: Hints, ) -> NameSet
Creates from a function that evaluates to a NameSet, and a
contains fast path.
Sourcepub fn from_async_evaluate_contains(
evaluate: Box<dyn Fn() -> BoxFuture<'static, Result<NameSet>> + Send + Sync>,
contains: Box<dyn for<'a> Fn(&'a MetaSet, &'a VertexName) -> BoxFuture<'a, Result<bool>> + Send + Sync>,
hints: Hints,
) -> NameSet
pub fn from_async_evaluate_contains( evaluate: Box<dyn Fn() -> BoxFuture<'static, Result<NameSet>> + Send + Sync>, contains: Box<dyn for<'a> Fn(&'a MetaSet, &'a VertexName) -> BoxFuture<'a, Result<bool>> + Send + Sync>, hints: Hints, ) -> NameSet
Creates from an async function that evaluates to a NameSet, and a
async contains fast path.
Sourcepub fn difference(&self, other: &NameSet) -> NameSet
pub fn difference(&self, other: &NameSet) -> NameSet
Calculates the subset that is only in self, not in other.
Sourcepub fn intersection(&self, other: &NameSet) -> NameSet
pub fn intersection(&self, other: &NameSet) -> NameSet
Calculates the intersection of two sets.
Sourcepub fn filter(
&self,
filter_func: Box<dyn Fn(&VertexName) -> BoxFuture<'_, Result<bool>> + Send + Sync + 'static>,
) -> Self
pub fn filter( &self, filter_func: Box<dyn Fn(&VertexName) -> 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<NameSet>
pub async fn flatten(&self) -> Result<NameSet>
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.
Sourcepub async fn flatten_id(
&self,
id_map: Arc<dyn IdConvert + Send + Sync>,
dag: Arc<dyn DagAlgorithm + Send + Sync>,
) -> Result<NameSet>
pub async fn flatten_id( &self, id_map: Arc<dyn IdConvert + Send + Sync>, dag: Arc<dyn DagAlgorithm + Send + Sync>, ) -> Result<NameSet>
Convert this set to a static id set.
Sourcepub async fn flatten_names(&self) -> Result<NameSet>
pub async fn flatten_names(&self) -> Result<NameSet>
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. bisect) and control how to resolve in batches.
Trait Implementations§
Source§impl From<&VertexName> for NameSet
impl From<&VertexName> for NameSet
Source§fn from(name: &VertexName) -> NameSet
fn from(name: &VertexName) -> NameSet
Source§impl<'a> From<(LegacyCodeNeedIdAccess, SpanSet, &'a AbstractNameDag<IdDag<IndexedLogStore>, IdMap, IndexedLogNameDagPath, NameDagState>)> for NameSet
impl<'a> From<(LegacyCodeNeedIdAccess, SpanSet, &'a AbstractNameDag<IdDag<IndexedLogStore>, IdMap, IndexedLogNameDagPath, NameDagState>)> for NameSet
Source§impl From<VertexName> for NameSet
impl From<VertexName> for NameSet
Source§fn from(name: VertexName) -> NameSet
fn from(name: VertexName) -> NameSet
Auto Trait Implementations§
impl Freeze for NameSet
impl !RefUnwindSafe for NameSet
impl Send for NameSet
impl Sync for NameSet
impl Unpin for NameSet
impl !UnwindSafe for NameSet
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