Skip to content

Commit

Permalink
add data_mut method
Browse files Browse the repository at this point in the history
  • Loading branch information
Schabolon committed Nov 13, 2023
1 parent d72e9e3 commit da21907
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/elements/edge.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,9 @@ impl<E: Clone> Edge<E> {
self.data.as_ref()
}

pub fn data_mut(&mut self) -> Option<&mut E> {
self.data.as_mut()
}
pub fn color(&self, ctx: &Context) -> Color32 {
if self.selected {
return ctx.style().visuals.widgets.hovered.fg_stroke.color;
Expand Down
4 changes: 4 additions & 0 deletions src/elements/node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,10 @@ impl<N: Clone> Node<N> {
self.data.as_ref()
}

pub fn data_mut(&mut self) -> Option<&mut N> {
self.data.as_mut()
}

pub fn set_data(&mut self, data: Option<N>) {
self.data = data;
}
Expand Down

0 comments on commit da21907

Please sign in to comment.