pub enum StepId {
WithFlow {
flow: Arc<Flow>,
index: usize,
},
Standalone {
name: String,
index: usize,
},
}Expand description
A step identifier that provides access to both the step index and name.
This type has two variants:
WithFlow: Used during execution when you have access to the flow. More efficient as it doesn’t allocate for the name string.Standalone: Used in storage/serialization contexts where the flow isn’t available.
§Choosing a Constructor
When you have access to Arc<Flow>, prefer StepId::for_step() as it
avoids allocating a string for the step name. Use StepId::new() only
when the flow reference is not available (e.g., deserializing from storage).
§Note on Flow Lifetime
The WithFlow variant keeps the Arc<Flow> alive. If you need to store
a StepId without keeping the flow alive, use StepId::into_standalone()
or StepId::to_standalone().
Variants§
WithFlow
Step with flow reference - borrows name from flow, no allocation.
Fields
Standalone
Standalone step - owns the name string.
Implementations§
Source§impl StepId
impl StepId
Sourcepub fn for_step(flow: Arc<Flow>, index: usize) -> Self
pub fn for_step(flow: Arc<Flow>, index: usize) -> Self
Create a StepId from a flow reference.
This is the preferred constructor when you have access to Arc<Flow>
as it avoids allocating a string for the step name.
Sourcepub fn new(name: String, index: usize) -> Self
pub fn new(name: String, index: usize) -> Self
Create a standalone StepId without a flow reference.
Use this only when the flow reference is not available, such as when
deserializing from storage. If you have access to Arc<Flow>, prefer
StepId::for_step() instead to avoid the string allocation.
Sourcepub fn to_standalone(&self) -> Self
pub fn to_standalone(&self) -> Self
Convert to a standalone StepId, cloning if necessary.
This releases the flow reference if held. Useful when you need to store the StepId without keeping the flow alive, or when serializing.
Sourcepub fn into_standalone(self) -> Self
pub fn into_standalone(self) -> Self
Convert into a standalone StepId, consuming self.
This releases the flow reference if held. More efficient than
to_standalone() when you don’t need the original.
Trait Implementations§
Source§impl Ord for StepId
impl Ord for StepId
Source§impl PartialOrd for StepId
impl PartialOrd for StepId
impl Eq for StepId
Auto Trait Implementations§
impl Freeze for StepId
impl RefUnwindSafe for StepId
impl Send for StepId
impl Sync for StepId
impl Unpin for StepId
impl UnsafeUnpin for StepId
impl UnwindSafe for StepId
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.