From 96521333d678ad8412b71cf5b878af89f35cbf3a Mon Sep 17 00:00:00 2001 From: Dennis Kobert Date: Sun, 6 Sep 2026 15:13:57 +0000 Subject: [PATCH] Rename SharedEdge to SharedSource --- .../libraries/core-types/src/registry.rs | 32 +++++++++---------- 1 file changed, 16 insertions(+), 16 deletions(-) diff --git a/node-graph/libraries/core-types/src/registry.rs b/node-graph/libraries/core-types/src/registry.rs index 886bb2b128..6dbac7aaca 100644 --- a/node-graph/libraries/core-types/src/registry.rs +++ b/node-graph/libraries/core-types/src/registry.rs @@ -108,12 +108,12 @@ pub enum ConstructionError { Type { expected: Box, found: Box }, } -pub struct SharedEdge { +pub struct SharedSource { ptr: std::ptr::NonNull, own: std::sync::Arc, } -impl SharedEdge { +impl SharedSource { pub fn new(own: std::sync::Arc) -> Self { Self { ptr: std::ptr::NonNull::from(&*own), @@ -135,11 +135,11 @@ impl SharedEdge { // SAFETY: `ptr` is derived from the owned Arc and never mutated through, so the edge is exactly as // thread safe as the payload it shares. -unsafe impl Send for SharedEdge {} +unsafe impl Send for SharedSource {} // SAFETY: as in Send. -unsafe impl Sync for SharedEdge {} +unsafe impl Sync for SharedSource {} -impl Node for SharedEdge +impl Node for SharedSource where N: Node + ?Sized, { @@ -218,15 +218,15 @@ impl EdgeHandle { pub fn new_erased(node: std::sync::Arc, ty: Type) -> Self where N: ?Sized + 'static + for<'c> Node>, - SharedEdge: WasmNotSend + WasmNotSync, + SharedSource: WasmNotSend + WasmNotSync, { Self { - node: Box::new(SharedEdge::new(node)), - share: |edge| Box::new(edge.downcast_ref::>().expect("share hook matches the stored edge type").share()), - serialize: |edge| Node::::serialize(edge.downcast_ref::>().expect("serialize hook matches the stored edge type")), - layout: |edge| Node::::layout(edge.downcast_ref::>().expect("layout hook matches the stored edge type")), + node: Box::new(SharedSource::new(node)), + share: |edge| Box::new(edge.downcast_ref::>().expect("share hook matches the stored edge type").share()), + serialize: |edge| Node::::serialize(edge.downcast_ref::>().expect("serialize hook matches the stored edge type")), + layout: |edge| Node::::layout(edge.downcast_ref::>().expect("layout hook matches the stored edge type")), set_layout: |edge, layout| { - let shared = edge.downcast_mut::>().expect("set_layout hook matches the stored edge type"); + let shared = edge.downcast_mut::>().expect("set_layout hook matches the stored edge type"); let node = std::sync::Arc::get_mut(&mut shared.own).expect("layout is installed before the node is shared"); Node::::set_layout(node, layout); shared.rederive(); @@ -262,19 +262,19 @@ impl EdgeHandle { (self.set_layout)(&mut *self.node, layout); } - pub fn downcast_record(self) -> Result, ConstructionError> { + pub fn downcast_record(self) -> Result, ConstructionError> { self.downcast_erased(record_edge_type::()) } /// The erased record edge, for callers that dispatch on the layout rather /// than a static element type. `None` for an edge erased to another node type. - pub fn record_edge(self) -> Option> { - self.node.downcast::>().ok().map(|edge| *edge) + pub fn record_edge(self) -> Option> { + self.node.downcast::>().ok().map(|edge| *edge) } - pub fn downcast_erased(self, expected: Type) -> Result, ConstructionError> { + pub fn downcast_erased(self, expected: Type) -> Result, ConstructionError> { let found = self.ty; - self.node.downcast::>().map(|edge| *edge).map_err(|_| ConstructionError::Type { + self.node.downcast::>().map(|edge| *edge).map_err(|_| ConstructionError::Type { expected: Box::new(expected), found: Box::new(found), })