Skip to content

Commit 8add6f0

Browse files
committed
Move Complex type into type alias
1 parent 34f8a80 commit 8add6f0

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

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

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

30+
type MonitorValue<I, T> = Arc<Mutex<Option<Arc<IORecord<I, T>>>>>;
31+
3032
/// Caches the output of the last graph evaluation for introspection.
3133
#[node_macro::node(category("Monitor"), path(graphene_core::memo), serialize(serialize_monitor), skip_impl)]
3234
async fn monitor<I: Clone + 'static + Send + Sync, T: Clone + 'static + Send + Sync>(
3335
input: I,
3436
#[allow(clippy::type_complexity)]
3537
#[data]
36-
io: Arc<Mutex<Option<Arc<IORecord<I, T>>>>>,
38+
io: MonitorValue<I, T>,
3739
node: impl Node<I, Output = T>,
3840
) -> T {
3941
let output = node.eval(input.clone()).await;
4042
*io.lock().unwrap() = Some(Arc::new(IORecord { input, output: output.clone() }));
4143
output
4244
}
4345

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>> {
46+
fn serialize_monitor<I: Clone + 'static + Send + Sync, T: Clone + 'static + Send + Sync>(io: &MonitorValue<I, T>) -> Option<Arc<dyn std::any::Any + Send + Sync>> {
4547
let io = io.lock().unwrap();
4648
io.as_ref().map(|output| output.clone() as Arc<dyn std::any::Any + Send + Sync>)
4749
}

0 commit comments

Comments
 (0)