Skip to main content

GraphAssert

Trait GraphAssert 

Source
pub trait GraphAssert<'g>: Copy + Debug {
    type Id: Copy + Eq + Hash + Debug;
    type Metadata: GraphMetadata<'g, Id = Self::Id>;
    type Query: GraphQuery<'g, Id = Self::Id, Set = Self::Set>;
    type Set: GraphSet<'g, Id = Self::Id, Metadata = Self::Metadata>;

    const NAME: &'static str;
Show 15 methods // Required methods fn depends_on(&self, a_id: Self::Id, b_id: Self::Id) -> Result<bool, Error>; fn directly_depends_on( &self, a_id: Self::Id, b_id: Self::Id, ) -> Result<bool, Error>; fn has_self_edge(&self, id: Self::Id) -> bool; fn is_cyclic(&self, a_id: Self::Id, b_id: Self::Id) -> Result<bool, Error>; fn all_cycles(&self) -> Vec<Vec<Self::Id>>; fn query( &self, initials: impl IntoIterator<Item = Self::Id>, direction: DependencyDirection, ) -> Self::Query; // Provided methods fn resolve( &self, initials: &[Self::Id], direction: DependencyDirection, ) -> Self::Set { ... } fn ids( &self, initials: &[Self::Id], query_direction: DependencyDirection, iter_direction: DependencyDirection, ) -> Vec<Self::Id> { ... } fn root_ids( &self, initials: &[Self::Id], query_direction: DependencyDirection, iter_direction: DependencyDirection, ) -> Vec<Self::Id> { ... } fn root_metadatas( &self, initials: &[Self::Id], query_direction: DependencyDirection, iter_direction: DependencyDirection, ) -> Vec<Self::Metadata> { ... } fn assert_topo_order( &self, topo_ids: impl IntoIterator<Item = Self::Id>, direction: DependencyDirection, msg: &str, ) { ... } fn assert_depends_on_any( &self, source_ids: &[Self::Id], query_id: Self::Id, direction: DependencyDirection, msg: &str, ) { ... } fn assert_depends_on( &self, a_id: Self::Id, b_id: Self::Id, direction: DependencyDirection, msg: &str, ) { ... } fn assert_not_depends_on( &self, a_id: Self::Id, b_id: Self::Id, direction: DependencyDirection, msg: &str, ) { ... } fn assert_directly_depends_on( &self, a_id: Self::Id, b_id: Self::Id, direction: DependencyDirection, msg: &str, ) { ... }
}

Required Associated Constants§

Source

const NAME: &'static str

Required Associated Types§

Source

type Id: Copy + Eq + Hash + Debug

Source

type Metadata: GraphMetadata<'g, Id = Self::Id>

Source

type Query: GraphQuery<'g, Id = Self::Id, Set = Self::Set>

Source

type Set: GraphSet<'g, Id = Self::Id, Metadata = Self::Metadata>

Required Methods§

Source

fn depends_on(&self, a_id: Self::Id, b_id: Self::Id) -> Result<bool, Error>

Source

fn directly_depends_on( &self, a_id: Self::Id, b_id: Self::Id, ) -> Result<bool, Error>

Source

fn has_self_edge(&self, id: Self::Id) -> bool

Returns true if there is a self-loop edge on id in the graph, computed via a different code path than directly_depends_on so it can be used as an independent oracle.

Source

fn is_cyclic(&self, a_id: Self::Id, b_id: Self::Id) -> Result<bool, Error>

Source

fn all_cycles(&self) -> Vec<Vec<Self::Id>>

Returns every cycle in the graph as a list of node IDs. Used by cycle-consistency proptests to cross-check against is_cyclic.

Source

fn query( &self, initials: impl IntoIterator<Item = Self::Id>, direction: DependencyDirection, ) -> Self::Query

Provided Methods§

Source

fn resolve( &self, initials: &[Self::Id], direction: DependencyDirection, ) -> Self::Set

Source

fn ids( &self, initials: &[Self::Id], query_direction: DependencyDirection, iter_direction: DependencyDirection, ) -> Vec<Self::Id>

Source

fn root_ids( &self, initials: &[Self::Id], query_direction: DependencyDirection, iter_direction: DependencyDirection, ) -> Vec<Self::Id>

Source

fn root_metadatas( &self, initials: &[Self::Id], query_direction: DependencyDirection, iter_direction: DependencyDirection, ) -> Vec<Self::Metadata>

Source

fn assert_topo_order( &self, topo_ids: impl IntoIterator<Item = Self::Id>, direction: DependencyDirection, msg: &str, )

Source

fn assert_depends_on_any( &self, source_ids: &[Self::Id], query_id: Self::Id, direction: DependencyDirection, msg: &str, )

Source

fn assert_depends_on( &self, a_id: Self::Id, b_id: Self::Id, direction: DependencyDirection, msg: &str, )

Source

fn assert_not_depends_on( &self, a_id: Self::Id, b_id: Self::Id, direction: DependencyDirection, msg: &str, )

Source

fn assert_directly_depends_on( &self, a_id: Self::Id, b_id: Self::Id, direction: DependencyDirection, msg: &str, )

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl<'g> GraphAssert<'g> for &'g PackageGraph

Source§

const NAME: &'static str = "package"

Source§

type Id = &'g PackageId

Source§

type Metadata = PackageMetadata<'g>

Source§

type Query = PackageQuery<'g>

Source§

type Set = PackageSet<'g>

Source§

fn depends_on(&self, a_id: Self::Id, b_id: Self::Id) -> Result<bool, Error>

Source§

fn directly_depends_on( &self, a_id: Self::Id, b_id: Self::Id, ) -> Result<bool, Error>

Source§

fn has_self_edge(&self, id: Self::Id) -> bool

Source§

fn is_cyclic(&self, a_id: Self::Id, b_id: Self::Id) -> Result<bool, Error>

Source§

fn all_cycles(&self) -> Vec<Vec<Self::Id>>

Source§

fn query( &self, initials: impl IntoIterator<Item = Self::Id>, direction: DependencyDirection, ) -> Self::Query

Source§

impl<'g> GraphAssert<'g> for FeatureGraph<'g>

Source§

const NAME: &'static str = "feature"

Source§

type Id = FeatureId<'g>

Source§

type Metadata = FeatureMetadata<'g>

Source§

type Query = FeatureQuery<'g>

Source§

type Set = FeatureSet<'g>

Source§

fn depends_on(&self, a_id: Self::Id, b_id: Self::Id) -> Result<bool, Error>

Source§

fn directly_depends_on( &self, a_id: Self::Id, b_id: Self::Id, ) -> Result<bool, Error>

Source§

fn has_self_edge(&self, id: Self::Id) -> bool

Source§

fn is_cyclic(&self, a_id: Self::Id, b_id: Self::Id) -> Result<bool, Error>

Source§

fn all_cycles(&self) -> Vec<Vec<Self::Id>>

Source§

fn query( &self, initials: impl IntoIterator<Item = Self::Id>, direction: DependencyDirection, ) -> Self::Query

Implementors§