pub struct Graph { /* private fields */ }Implementations§
Source§impl Graph
impl Graph
Sourcepub fn try_from_parts(
nodes: impl IntoIterator<Item = Node>,
edges: impl IntoIterator<Item = Edge>,
) -> Result<Self>
pub fn try_from_parts( nodes: impl IntoIterator<Item = Node>, edges: impl IntoIterator<Item = Edge>, ) -> Result<Self>
Creates a validated graph and canonicalizes its ordering.
§Errors
Returns an error for conflicting nodes, dangling edges, empty extractor identities, or invalid source spans.
pub fn nodes(&self) -> &[Node]
pub fn edges(&self) -> &[Edge]
pub fn node(&self, id: &str) -> Option<&Node>
pub fn outgoing<'graph>( &'graph self, id: &'graph NodeId, ) -> impl Iterator<Item = &'graph Edge>
pub fn incoming<'graph>( &'graph self, id: &'graph NodeId, ) -> impl Iterator<Item = &'graph Edge>
pub const fn node_count(&self) -> usize
pub const fn edge_count(&self) -> usize
pub const fn is_empty(&self) -> bool
pub fn into_parts(self) -> (Vec<Node>, Vec<Edge>)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Graph
impl<'de> Deserialize<'de> for Graph
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for Graph
impl StructuralPartialEq for Graph
Source§impl TryFrom<LegacyGraph> for Graph
impl TryFrom<LegacyGraph> for Graph
Source§type Error = GraphError
type Error = GraphError
The type returned in the event of a conversion error.
Source§fn try_from(value: LegacyGraph) -> Result<Self>
fn try_from(value: LegacyGraph) -> Result<Self>
Performs the conversion.
Auto Trait Implementations§
impl Freeze for Graph
impl RefUnwindSafe for Graph
impl Send for Graph
impl Sync for Graph
impl Unpin for Graph
impl UnsafeUnpin for Graph
impl UnwindSafe for Graph
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
Mutably borrows from an owned value. Read more