Skip to content

Commit

Permalink
create python NodeState from Arc
Browse files Browse the repository at this point in the history
  • Loading branch information
ljeub-pometry committed Dec 9, 2024
1 parent 419db76 commit 9eb475d
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions raphtory/src/python/graph/node_state.rs
Original file line number Diff line number Diff line change
Expand Up @@ -313,8 +313,8 @@ macro_rules! impl_node_state {
}

impl $name {
pub fn inner(&self) -> &NodeState<'static, $value, DynamicGraph, DynamicGraph> {
self.inner.as_ref()
pub fn inner(&self) -> &Arc<NodeState<'static, $value, DynamicGraph, DynamicGraph>> {
&self.inner
}
}

Expand All @@ -335,6 +335,12 @@ macro_rules! impl_node_state {
}
}

impl From<Arc<NodeState<'static, $value, DynamicGraph, DynamicGraph>>> for $name {
fn from(inner: Arc<NodeState<'static, $value, DynamicGraph, DynamicGraph>>) -> Self {
$name { inner }
}
}

impl pyo3::IntoPy<PyObject> for NodeState<'static, $value, DynamicGraph, DynamicGraph> {
fn into_py(self, py: Python<'_>) -> PyObject {
$name::from(self).into_py(py)
Expand Down

0 comments on commit 9eb475d

Please sign in to comment.