pub struct Effect {
pub inputs: StackType,
pub outputs: StackType,
pub effects: Vec<SideEffect>,
}Expand description
Stack effect: transformation from input stack to output stack Example: ( ..a Int – ..a Bool ) means:
- Consumes an Int from stack with ..a underneath
- Produces a Bool on stack with ..a underneath
With computational effects: ( ..a Int – ..a Bool | Yield Int )
- Same stack transformation
- May also yield Int values (generator effect)
Fields§
§inputs: StackTypeInput stack type (before word executes)
outputs: StackTypeOutput stack type (after word executes)
effects: Vec<SideEffect>Computational side effects (Yield, etc.)
Implementations§
Source§impl Effect
impl Effect
Sourcepub fn new(inputs: StackType, outputs: StackType) -> Self
pub fn new(inputs: StackType, outputs: StackType) -> Self
Create a new stack effect (pure, no side effects)
Sourcepub fn with_effects(
inputs: StackType,
outputs: StackType,
effects: Vec<SideEffect>,
) -> Self
pub fn with_effects( inputs: StackType, outputs: StackType, effects: Vec<SideEffect>, ) -> Self
Create a new stack effect with computational effects
Sourcepub fn yield_type(&self) -> Option<&Type>
pub fn yield_type(&self) -> Option<&Type>
Get the yield type if this effect has one
Trait Implementations§
impl Eq for Effect
impl StructuralPartialEq for Effect
Auto Trait Implementations§
impl Freeze for Effect
impl RefUnwindSafe for Effect
impl Send for Effect
impl Sync for Effect
impl Unpin for Effect
impl UnwindSafe for Effect
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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
Compare self to
key and return true if they are equal.