From 1ac8f4ead494084e870c44cf63c0f048cf07c476 Mon Sep 17 00:00:00 2001 From: Shadowfacts Date: Thu, 31 Oct 2024 22:46:36 -0400 Subject: [PATCH] Use structs not enums for Synchronicity types --- crates/graph/src/lib.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/graph/src/lib.rs b/crates/graph/src/lib.rs index 7afa962..ff7070d 100644 --- a/crates/graph/src/lib.rs +++ b/crates/graph/src/lib.rs @@ -36,7 +36,7 @@ pub trait Synchronicity: 'static { fn make_update_result<'a>() -> Self::UpdateResult<'a>; } -pub enum Synchronous {} +pub struct Synchronous; impl Synchronicity for Synchronous { type UpdateFn = Box) -> ()>; @@ -53,7 +53,7 @@ impl Synchronicity for Synchronous { fn make_update_result<'a>() -> Self::UpdateResult<'a> {} } -pub enum Asynchronous {} +pub struct Asynchronous; impl Synchronicity for Asynchronous { type UpdateFn = @@ -480,7 +480,7 @@ impl Node for ConstNode { fn visit_inputs(&self, _visitor: &mut dyn FnMut(NodeIndex) -> ()) {} - fn update(&mut self) -> ::UpdateResult<'_> { + fn update(&mut self) -> S::UpdateResult<'_> { unreachable!() } @@ -526,7 +526,7 @@ impl Node for RuleNode self.rule.visit_inputs(&mut InputIndexVisitor(visitor)); } - fn update(&mut self) -> ::UpdateResult<'_> { + fn update(&mut self) -> S::UpdateResult<'_> { let new_value = self.rule.evaluate(); self.valid = true; *self.value.borrow_mut() = Some(new_value);