Struct dot_parser::ast::Graph
source · [−]pub struct Graph<'a, A = (&'a str, &'a str)> {
pub strict: bool,
pub is_digraph: bool,
pub name: Option<&'a str>,
pub stmts: StmtList<'a, A>,
}
Expand description
This structure is an AST for the DOT graph language. The generic A
denotes the type of attributes. By default (and when parsing), it is
(&'a str, &'a str)
, i.e. two strings, one for the key and one for the
value of the attribute. The library provides functions to map from one type
to an other.
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.
stmts: StmtList<'a, A>
The statements that describe 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
sourceimpl<'a, A: Ord> Ord for Graph<'a, A>
impl<'a, A: Ord> Ord for Graph<'a, A>
1.21.0 · sourcefn max(self, other: Self) -> Self
fn max(self, other: Self) -> Self
Compares and returns the maximum of two values. Read more
1.21.0 · sourcefn min(self, other: Self) -> Self
fn min(self, other: Self) -> Self
Compares and returns the minimum of two values. Read more
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: PartialOrd<Self>,
Restrict a value to a certain interval. Read more
sourceimpl<'a, A: PartialEq> PartialEq<Graph<'a, A>> for Graph<'a, A>
impl<'a, A: PartialEq> PartialEq<Graph<'a, A>> for Graph<'a, A>
sourceimpl<'a, A: PartialOrd> PartialOrd<Graph<'a, A>> for Graph<'a, A>
impl<'a, A: PartialOrd> PartialOrd<Graph<'a, A>> for Graph<'a, A>
sourcefn partial_cmp(&self, other: &Graph<'a, A>) -> Option<Ordering>
fn partial_cmp(&self, other: &Graph<'a, A>) -> Option<Ordering>
This method returns an ordering between self
and other
values if one exists. Read more
1.0.0 · sourcefn lt(&self, other: &Rhs) -> bool
fn lt(&self, other: &Rhs) -> bool
This method tests less than (for self
and other
) and is used by the <
operator. Read more
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for self
and other
) and is used by the <=
operator. Read more
impl<'a, A: Eq> Eq for Graph<'a, A>
impl<'a, A> StructuralEq for Graph<'a, A>
impl<'a, A> StructuralPartialEq for Graph<'a, A>
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