diff --git a/dasp_graph/src/lib.rs b/dasp_graph/src/lib.rs index 16c4f7c2..20aa7094 100644 --- a/dasp_graph/src/lib.rs +++ b/dasp_graph/src/lib.rs @@ -125,6 +125,11 @@ pub use buffer::Buffer; pub use node::{Input, Node}; + +// Petgraph's traits appear in the public API of dasp_graph, so re-exporting +// allows the user to be guaranteed that they are using the correct version of +// petgraph, avoiding unintuitive errors like in #176. +pub use petgraph; use petgraph::data::{DataMap, DataMapMut}; use petgraph::visit::{ Data, DfsPostOrder, GraphBase, IntoNeighborsDirected, NodeCount, NodeIndexable, Reversed, @@ -147,9 +152,8 @@ pub mod node; /// # Example /// /// ``` -/// use dasp_graph::{Node, NodeData}; +/// use dasp_graph::{petgraph, Node, NodeData}; /// # use dasp_graph::{Buffer, Input}; -/// use petgraph; /// # /// # // The node type. (Hint: Use existing node impls by enabling their associated features). /// # struct MyNode; diff --git a/dasp_graph/tests/graph_send.rs b/dasp_graph/tests/graph_send.rs index 8bde1188..ceef9d22 100644 --- a/dasp_graph/tests/graph_send.rs +++ b/dasp_graph/tests/graph_send.rs @@ -5,8 +5,10 @@ #![cfg(feature = "node-boxed")] #![allow(unreachable_code, unused_variables)] -use dasp_graph::{BoxedNodeSend, NodeData}; -use petgraph::visit::GraphBase; +use dasp_graph::{ + petgraph::{self, visit::GraphBase}, + BoxedNodeSend, NodeData, +}; #[test] #[should_panic] diff --git a/dasp_graph/tests/graph_types.rs b/dasp_graph/tests/graph_types.rs index a7b0212d..34638ad3 100644 --- a/dasp_graph/tests/graph_types.rs +++ b/dasp_graph/tests/graph_types.rs @@ -5,8 +5,10 @@ #![cfg(feature = "node-boxed")] #![allow(unreachable_code, unused_variables)] -use dasp_graph::{BoxedNode, NodeData}; -use petgraph::visit::GraphBase; +use dasp_graph::{ + petgraph::{self, visit::GraphBase}, + BoxedNode, NodeData, +}; #[test] #[should_panic] diff --git a/dasp_graph/tests/sum.rs b/dasp_graph/tests/sum.rs index 4c27a69f..13a433a9 100644 --- a/dasp_graph/tests/sum.rs +++ b/dasp_graph/tests/sum.rs @@ -1,6 +1,6 @@ #![cfg(all(feature = "node-boxed", feature = "node-sum"))] -use dasp_graph::{node, Buffer, Input, Node, NodeData}; +use dasp_graph::{node, petgraph, Buffer, Input, Node, NodeData}; type BoxedNode = dasp_graph::BoxedNode;