diff --git a/hydroflow_plus/src/optional.rs b/hydroflow_plus/src/optional.rs index ddf05115633c..71eab96cbd0f 100644 --- a/hydroflow_plus/src/optional.rs +++ b/hydroflow_plus/src/optional.rs @@ -6,7 +6,7 @@ use std::rc::Rc; use stageleft::{q, IntoQuotedMut, Quoted}; use syn::parse_quote; -use crate::builder::{FlowState, FLOW_USED_MESSAGE}; +use crate::builder::FLOW_USED_MESSAGE; use crate::cycle::{CycleCollection, CycleComplete, DeferTick, ForwardRef, TickCycle}; use crate::ir::{HfPlusLeaf, HfPlusNode, HfPlusSource, TeeNode}; use crate::location::{check_matching_location, LocationId, NoTick}; @@ -35,10 +35,6 @@ impl<'a, T, W, N: Location<'a>> Optional { fn location_kind(&self) -> LocationId { self.location.id() } - - fn flow_state(&self) -> &FlowState { - self.location.flow_state() - } } impl<'a, T, N: Location<'a>> DeferTick for Optional> { @@ -64,8 +60,8 @@ impl<'a, T, N: Location<'a>> CycleCollection<'a, TickCycle> for Optional> CycleComplete<'a, TickCycle> for Optional> { fn complete(self, ident: syn::Ident) { - self.flow_state() - .clone() + self.location + .flow_state() .borrow_mut() .leaves .as_mut() @@ -95,8 +91,8 @@ impl<'a, T, N: Location<'a>> CycleCollection<'a, ForwardRef> for Optional> CycleComplete<'a, ForwardRef> for Optional> { fn complete(self, ident: syn::Ident) { - self.flow_state() - .clone() + self.location + .flow_state() .borrow_mut() .leaves .as_mut() @@ -126,8 +122,8 @@ impl<'a, T, W, N: Location<'a> + NoTick> CycleCollection<'a, ForwardRef> for Opt impl<'a, T, W, N: Location<'a> + NoTick> CycleComplete<'a, ForwardRef> for Optional { fn complete(self, ident: syn::Ident) { - self.flow_state() - .clone() + self.location + .flow_state() .borrow_mut() .leaves .as_mut() diff --git a/hydroflow_plus/src/singleton.rs b/hydroflow_plus/src/singleton.rs index 608fa8dae742..7271cc4a0854 100644 --- a/hydroflow_plus/src/singleton.rs +++ b/hydroflow_plus/src/singleton.rs @@ -5,7 +5,7 @@ use std::rc::Rc; use stageleft::{q, IntoQuotedMut, Quoted}; -use crate::builder::{FlowState, FLOW_USED_MESSAGE}; +use crate::builder::FLOW_USED_MESSAGE; use crate::cycle::{ CycleCollection, CycleCollectionWithInitial, CycleComplete, DeferTick, ForwardRef, TickCycle, }; @@ -33,10 +33,6 @@ impl<'a, T, W, N: Location<'a>> Singleton { fn location_kind(&self) -> LocationId { self.location.id() } - - fn flow_state(&self) -> &FlowState { - self.location.flow_state() - } } impl<'a, T, N: Location<'a>> From> for Singleton { @@ -73,8 +69,8 @@ impl<'a, T, N: Location<'a>> CycleCollectionWithInitial<'a, TickCycle> impl<'a, T, N: Location<'a>> CycleComplete<'a, TickCycle> for Singleton> { fn complete(self, ident: syn::Ident) { - self.flow_state() - .clone() + self.location + .flow_state() .borrow_mut() .leaves .as_mut() @@ -104,8 +100,8 @@ impl<'a, T, N: Location<'a>> CycleCollection<'a, ForwardRef> for Singleton> CycleComplete<'a, ForwardRef> for Singleton> { fn complete(self, ident: syn::Ident) { - self.flow_state() - .clone() + self.location + .flow_state() .borrow_mut() .leaves .as_mut() diff --git a/hydroflow_plus/src/stream.rs b/hydroflow_plus/src/stream.rs index 777f8648bd49..065635d2d9f7 100644 --- a/hydroflow_plus/src/stream.rs +++ b/hydroflow_plus/src/stream.rs @@ -12,7 +12,7 @@ use serde::Serialize; use stageleft::{q, IntoQuotedMut, Quoted}; use syn::parse_quote; -use crate::builder::{FlowState, FLOW_USED_MESSAGE}; +use crate::builder::FLOW_USED_MESSAGE; use crate::cycle::{CycleCollection, CycleComplete, DeferTick, ForwardRef, TickCycle}; use crate::ir::{DebugInstantiate, HfPlusLeaf, HfPlusNode, TeeNode}; use crate::location::cluster::ClusterSelfId; @@ -46,10 +46,6 @@ pub struct Stream { } impl<'a, T, W, N: Location<'a>> Stream { - fn flow_state(&self) -> &FlowState { - self.location.flow_state() - } - fn location_kind(&self) -> LocationId { self.location.id() } @@ -78,8 +74,8 @@ impl<'a, T, N: Location<'a>> CycleCollection<'a, TickCycle> for Stream> CycleComplete<'a, TickCycle> for Stream> { fn complete(self, ident: syn::Ident) { - self.flow_state() - .clone() + self.location + .flow_state() .borrow_mut() .leaves .as_mut() @@ -109,8 +105,8 @@ impl<'a, T, W, N: Location<'a> + NoTick> CycleCollection<'a, ForwardRef> for Str impl<'a, T, W, N: Location<'a> + NoTick> CycleComplete<'a, ForwardRef> for Stream { fn complete(self, ident: syn::Ident) { - self.flow_state() - .clone() + self.location + .flow_state() .borrow_mut() .leaves .as_mut() @@ -494,8 +490,8 @@ impl<'a, T, W, N: Location<'a> + NoTick> Stream { } pub fn for_each(self, f: impl IntoQuotedMut<'a, F>) { - self.flow_state() - .clone() + self.location + .flow_state() .borrow_mut() .leaves .as_mut() @@ -507,8 +503,8 @@ impl<'a, T, W, N: Location<'a> + NoTick> Stream { } pub fn dest_sink + 'a>(self, sink: impl Quoted<'a, S>) { - self.flow_state() - .clone() + self.location + .flow_state() .borrow_mut() .leaves .as_mut() @@ -664,8 +660,7 @@ impl<'a, T, W, N: Location<'a> + NoTick> Stream { { let serialize_pipeline = Some(serialize_bincode::(N::is_demux())); - let flow_state = self.flow_state().clone(); - let mut flow_state_borrow = flow_state.borrow_mut(); + let mut flow_state_borrow = self.location.flow_state().borrow_mut(); let external_key = flow_state_borrow.next_external_out; flow_state_borrow.next_external_out += 1; @@ -725,8 +720,7 @@ impl<'a, T, W, N: Location<'a> + NoTick> Stream { where N: CanSend<'a, ExternalProcess<'a, N2>, In = T, Out = Bytes>, { - let flow_state = self.flow_state().clone(); - let mut flow_state_borrow = flow_state.borrow_mut(); + let mut flow_state_borrow = self.location.flow_state().borrow_mut(); let external_key = flow_state_borrow.next_external_out; flow_state_borrow.next_external_out += 1;