pub trait GraphReadWriter<NodeWeight, EdgeWeight>: Graph<NodeWeight, EdgeWeight> {
// Required methods
fn serialize_graph_to_file(&self, path: &str) -> Result<(), Error>;
fn deserialize_graph_from_file(path: &str) -> Result<Box<Self>, Error>;
}Expand description
Trait to serialize and deserialize a given Graph to a file. The file format depends on the graph type being used and can only be assumed compatible with the same graph type.
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl<NodeWeight, EdgeWeight, EdgeType> GraphReadWriter<NodeWeight, EdgeWeight> for Graph<NodeWeight, EdgeWeight, EdgeType, DefaultIx>where
NodeWeight: Serialize + DeserializeOwned,
EdgeWeight: Serialize + DeserializeOwned,
EdgeType: EdgeType,
Implementation of GraphReadWriter trait using serde_json.
Nodes and Edges need to implement Serializable and Deserializable
in order for serde to work.
impl<NodeWeight, EdgeWeight, EdgeType> GraphReadWriter<NodeWeight, EdgeWeight> for Graph<NodeWeight, EdgeWeight, EdgeType, DefaultIx>where
NodeWeight: Serialize + DeserializeOwned,
EdgeWeight: Serialize + DeserializeOwned,
EdgeType: EdgeType,
Implementation of GraphReadWriter trait using serde_json. Nodes and Edges need to implement Serializable and Deserializable in order for serde to work.