Graph

Struct Graph 

Source
pub struct Graph<'a> { /* private fields */ }
Expand description

Graph is a structure that holds the relational information between products, and has methods to add products to the relational graph

Implementations§

Source§

impl<'a> Graph<'a>

Source

pub fn new(db: &'a DB) -> Graph<'_>

Created a new graph that will be associated with the specified database

Source

pub fn get_name(&self, number: NodeIndex<DefaultIx>) -> String

Resolves the index of a graph node into a string of the product name at that node

Source

pub fn add_or_update_product(&mut self, name: String, node_type: NodeType)

Add a product to the graph, or update the node type of that product if it already exists

Source

pub fn has_product(&self, name: &String) -> bool

Checks if the graph contains a given product

Source

pub fn product_versions(&self, name: &String) -> Vec<&String>

Returns all the different versions of a product that the graph describes. I.E. different nodes in the graph may point to a given product as a dependency with different version of that dependency listed as a requirement

Source

pub fn is_optional(&self, name: &String) -> bool

Determines if a given node is listed as an optional node in the graph

Source

pub fn connect_products( &mut self, source: &String, target: &String, version: String, ) -> Result<(), &str>

Connects two products (nodes) in the graph together with a specific version. Note that this is a directional graph so the version requirement will point from the source to the target node

Source

pub fn add_product_by_tag( &mut self, product: String, tag: &Vec<&String>, version_type: VersionType, node_type: NodeType, recurse: bool, )

Add a product to the graph specified by a given tag. This tag is looked up in the database associated with this graph and resolved into a table file. Optionally add in the dependencies from the table file if recurse is true

Source

pub fn add_product_by_version( &mut self, product: String, version: String, version_type: VersionType, node_type: NodeType, recurse: bool, )

Add a product to the graph specified by a given version. This version is looked up in the database associated with this graph and resolved into a table file. Optionally add in the dependencies from the table file if recurse is true

Source

pub fn add_table( &mut self, table: &Table, version_type: VersionType, node_type: NodeType, tag: Option<&Vec<&String>>, recurse: bool, )

Add a specific table into the graph of products. Optionally add in the dependencies from the table file if recurse is true

Source

pub fn iter( &self, ) -> WalkerIter<Topo<<Graph<NodeType, String> as GraphBase>::NodeId, <Graph<NodeType, String> as Visitable>::Map>, &Graph<NodeType, String>>

Iterates though the nodes of the graph

Trait Implementations§

Source§

impl<'a> Debug for Graph<'a>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Graph<'a>

§

impl<'a> !RefUnwindSafe for Graph<'a>

§

impl<'a> !Send for Graph<'a>

§

impl<'a> !Sync for Graph<'a>

§

impl<'a> Unpin for Graph<'a>

§

impl<'a> !UnwindSafe for Graph<'a>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.