Skip to content

Commit 96de229

Browse files
committed
Refactor Memo and Monitor Node to use node macro
1 parent 1a50401 commit 96de229

1 file changed

Lines changed: 4 additions & 22 deletions

File tree

node-graph/nodes/gcore/src/memo.rs

Lines changed: 4 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -27,21 +27,6 @@ async fn memo<I: Hash + Send + 'n, T: Clone + WasmNotSend>(input: I, #[data] cac
2727
value
2828
}
2929

30-
// Re-export the generated node as MemoNode for compatibility
31-
// pub use memo::MemoNode;
32-
33-
// #[allow(clippy::module_inception)]
34-
// pub mod memo {
35-
// use core_types::ProtoNodeIdentifier;
36-
37-
// pub const IDENTIFIER: ProtoNodeIdentifier = ProtoNodeIdentifier::new("graphene_core::memo::MemoNode");
38-
// }
39-
40-
fn serialize_monitor<I: Clone + 'static + Send + Sync, T: Clone + 'static + Send + Sync>(io: &Arc<Mutex<Option<Arc<IORecord<I, T>>>>>) -> Option<Arc<dyn std::any::Any + Send + Sync>> {
41-
let io = io.lock().unwrap();
42-
io.as_ref().map(|output| output.clone() as Arc<dyn std::any::Any + Send + Sync>)
43-
}
44-
4530
/// Caches the output of the last graph evaluation for introspection.
4631
#[node_macro::node(category("Monitor"), path(graphene_core::memo), serialize(serialize_monitor), skip_impl)]
4732
async fn monitor<I: Clone + 'static + Send + Sync, T: Clone + 'static + Send + Sync>(
@@ -56,10 +41,7 @@ async fn monitor<I: Clone + 'static + Send + Sync, T: Clone + 'static + Send + S
5641
output
5742
}
5843

59-
// pub use monitor::MonitorNode;
60-
61-
// pub mod monitor {
62-
// use core_types::ProtoNodeIdentifier;
63-
64-
// pub const IDENTIFIER: ProtoNodeIdentifier = ProtoNodeIdentifier::new("graphene_core::memo::MonitorNode");
65-
// }
44+
fn serialize_monitor<I: Clone + 'static + Send + Sync, T: Clone + 'static + Send + Sync>(io: &Arc<Mutex<Option<Arc<IORecord<I, T>>>>>) -> Option<Arc<dyn std::any::Any + Send + Sync>> {
45+
let io = io.lock().unwrap();
46+
io.as_ref().map(|output| output.clone() as Arc<dyn std::any::Any + Send + Sync>)
47+
}

0 commit comments

Comments
 (0)