Skip to content
Snippets Groups Projects
Commit b0ae1bdd authored by Udo Eisenbarth's avatar Udo Eisenbarth :speech_balloon:
Browse files

Add OpticGraph::node getting OpticRef by its Uuid.

parent 5035b4b5
No related branches found
No related tags found
1 merge request!34Add Uuid to OpticRef
......@@ -6,6 +6,7 @@ use serde::{
ser::SerializeStruct,
Deserialize, Serialize,
};
use uuid::Uuid;
use crate::optic_ref::OpticRef;
use crate::{
......@@ -106,6 +107,9 @@ impl OpticGraph {
.edges_directed(target_node, petgraph::Direction::Incoming)
.any(|e| e.weight().target_port() == target_port)
}
pub fn node(self, uuid: Uuid) -> Option<OpticRef> {
self.0.node_weights().find(|node| node.uuid()==uuid).cloned()
}
}
impl Serialize for OpticGraph {
fn serialize<S>(&self, serializer: S) -> std::result::Result<S::Ok, S::Error>
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment