Struct dot_parser::canonical::Graph
source · [−]pub struct Graph<'a, A> {
pub strict: bool,
pub is_digraph: bool,
pub name: Option<&'a str>,
pub attr: Vec<AttrStmt<A>>,
pub nodes: NodeSet<'a, A>,
pub edges: EdgeSet<'a, A>,
}
Expand description
A Graph
is a structure that can be created from a regular
Graph
, but that is more friendly to work with. For instance, in a Graph
,
attributes are most often given as a list of list of Attr
, while in a
Graph
, the lists are flatten.
Fields
strict: bool
Specifies if the Graph
is strict or not. A “strict” graph must not
contain the same edge multiple times. Notice that, for undirected edge,
an edge from A
to B
and an edge from B
to A
are equals.
is_digraph: bool
Specifies if the Graph
is directed.
name: Option<&'a str>
The name of the Graph
, if any.
attr: Vec<AttrStmt<A>>
The global attributes of the graph.
nodes: NodeSet<'a, A>
The nodes of the graph.
edges: EdgeSet<'a, A>
The edges of the graph.
Implementations
sourceimpl<'a, A> Graph<'a, A>
impl<'a, A> Graph<'a, A>
sourcepub fn filter_map<F, B>(self, f: F) -> Graph<'a, B>where
F: Fn(A) -> Option<B>,
pub fn filter_map<F, B>(self, f: F) -> Graph<'a, B>where
F: Fn(A) -> Option<B>,
Filter and map attributes. The main intended usage of this function is
to convert attributes as &'a str
into an enum, e.g.
to convert ["label"="whatever", "color"="foo"]
into
[Attr::Label(whatever), Attr::Color(foo)]
.
To take into account non-standard attributes, the Attr
enum has to be
provided by the user.
Trait Implementations
Auto Trait Implementations
impl<'a, A> RefUnwindSafe for Graph<'a, A>where
A: RefUnwindSafe,
impl<'a, A> Send for Graph<'a, A>where
A: Send,
impl<'a, A> Sync for Graph<'a, A>where
A: Sync,
impl<'a, A> Unpin for Graph<'a, A>where
A: Unpin,
impl<'a, A> UnwindSafe for Graph<'a, A>where
A: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more