diff --git a/src/draw/default_edge.rs b/src/draw/default_edge.rs index d606b95..63e281d 100644 --- a/src/draw/default_edge.rs +++ b/src/draw/default_edge.rs @@ -10,6 +10,7 @@ use crate::{draw::DrawContext, elements::EdgeProps, DisplayNode, Node}; use super::DisplayEdge; +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct DefaultEdgeShape { pub order: usize, diff --git a/src/draw/default_node.rs b/src/draw/default_node.rs index 5d42eac..cd2c2b9 100644 --- a/src/draw/default_node.rs +++ b/src/draw/default_node.rs @@ -11,6 +11,7 @@ use super::DisplayNode; /// This is the default node shape which is used to display nodes in the graph. /// /// You can use this implementation as an example for implementing your own custom node shapes. +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] #[derive(Clone, Debug)] pub struct DefaultNodeShape { pub pos: Pos2, diff --git a/src/elements/node.rs b/src/elements/node.rs index 80d5e4b..537a16f 100644 --- a/src/elements/node.rs +++ b/src/elements/node.rs @@ -159,4 +159,9 @@ where pub fn set_label(&mut self, label: String) { self.props.label = label } + + pub fn with_label(mut self, label: String) -> Self { + self.props.label = label; + self + } }