pub enum CommitShape {
ReadOnly,
FlushEvents,
Transactional {
invariants: Vec<IrPredicate>,
transitions: Vec<IrPredicate>,
},
}Expand description
P6.8’s real CommitShape (Part 6.7, R6.15, #1165) — a handler body’s own
resolved one-of-three commit shape, bynk_lower::lower_commit_shape_ir’s own
return value. Matches the reference’s own three-variant shape verbatim
(bynk-greenfield-compiler.md:1179-1183) — no substitution needed,
Transactional’s own payload already reuses IrPredicate rather than
carrying Invariant/Transition AST nodes directly. Shape-agnostic
between an agent and a service handler ([DECISION F]): as of P6.11
(#1171), bynk_lower::lower_service_handler_ir is the real service call
site this decision predicted, passing empty invariants/transitions
slices, and the identical write-detection walk
(bynk_lower::lower_commit_shape_ir’s own doc comment) naturally finds
neither a mutating Callee::Store nor a bare := in a service body (a
service declares no store fields to write), so Transactional is
never constructed for one — the shipped emitter’s own emit_service
already only ever produces the other two shapes, for the same reason.
Variants§
ReadOnly
No store write and no Events.emit — the body splices flat, no
commit or flush of any kind.
FlushEvents
No store write, but the body emits at least one event — __events
is flushed at the end of the handler, state is not copied.
Transactional
A mutating Callee::Store write or a bare := reaches this body —
state is snapshotted, the body runs in an IIFE, then the snapshot is
committed (and __events, if any, flushed alongside it). Carries
the agent’s own already-lowered invariants/transitions
(bynk_lower::lower_invariant_ir/bynk_lower::lower_transition_ir), not
the raw AST lists — a future consumer checking them at commit time
reads real IrPredicates, not Invariant/Transition nodes it
would have to lower itself.
Does not carry its own emits bit — matches the reference’s own
verbatim shape (bynk-greenfield-compiler.md:1182), which gives
Transactional no such field even though a writing handler that also
emits is real (the shipped emitter’s own writes_state/
body_emits_directly, emitter/emit.rs:3124/3290, are independent
booleans — a store write does not preclude an emit). A future
IrHandler consumer that needs both facts at once — to decide
whether this Transactional handler also flushes __events —
re-derives it the same way lower_commit_shape_ir’s own caller
already must ([DECISION D]: bynk_ir::block_uses_emit(body)),
not from this variant. Named here rather than silently assumed lost:
the fact is recoverable from body, which every real consumer holds
alongside a CommitShape in the first place — IrHandler itself
(real as of P6.9, #1167) is exactly that consumer, carrying both
commit/body side by side.
Trait Implementations§
Source§impl Clone for CommitShape
impl Clone for CommitShape
Source§fn clone(&self) -> CommitShape
fn clone(&self) -> CommitShape
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreAuto Trait Implementations§
impl Freeze for CommitShape
impl RefUnwindSafe for CommitShape
impl Send for CommitShape
impl Sync for CommitShape
impl Unpin for CommitShape
impl UnsafeUnpin for CommitShape
impl UnwindSafe for CommitShape
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,
§impl<T> Paint for Twhere
T: ?Sized,
impl<T> Paint for Twhere
T: ?Sized,
§fn fg(&self, value: Color) -> Painted<&T>
fn fg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the foreground set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like red() and
green(), which have the same functionality but are
pithier.
§Example
Set foreground color to white using fg():
use yansi::{Paint, Color};
painted.fg(Color::White);Set foreground color to white using white().
use yansi::Paint;
painted.white();§fn bright_black(&self) -> Painted<&T>
fn bright_black(&self) -> Painted<&T>
§fn bright_red(&self) -> Painted<&T>
fn bright_red(&self) -> Painted<&T>
§fn bright_green(&self) -> Painted<&T>
fn bright_green(&self) -> Painted<&T>
§fn bright_yellow(&self) -> Painted<&T>
fn bright_yellow(&self) -> Painted<&T>
§fn bright_blue(&self) -> Painted<&T>
fn bright_blue(&self) -> Painted<&T>
§fn bright_magenta(&self) -> Painted<&T>
fn bright_magenta(&self) -> Painted<&T>
§fn bright_cyan(&self) -> Painted<&T>
fn bright_cyan(&self) -> Painted<&T>
§fn bright_white(&self) -> Painted<&T>
fn bright_white(&self) -> Painted<&T>
§fn bg(&self, value: Color) -> Painted<&T>
fn bg(&self, value: Color) -> Painted<&T>
Returns a styled value derived from self with the background set to
value.
This method should be used rarely. Instead, prefer to use color-specific
builder methods like on_red() and
on_green(), which have the same functionality but
are pithier.
§Example
Set background color to red using fg():
use yansi::{Paint, Color};
painted.bg(Color::Red);Set background color to red using on_red().
use yansi::Paint;
painted.on_red();§fn on_primary(&self) -> Painted<&T>
fn on_primary(&self) -> Painted<&T>
§fn on_magenta(&self) -> Painted<&T>
fn on_magenta(&self) -> Painted<&T>
§fn on_bright_black(&self) -> Painted<&T>
fn on_bright_black(&self) -> Painted<&T>
§fn on_bright_red(&self) -> Painted<&T>
fn on_bright_red(&self) -> Painted<&T>
§fn on_bright_green(&self) -> Painted<&T>
fn on_bright_green(&self) -> Painted<&T>
§fn on_bright_yellow(&self) -> Painted<&T>
fn on_bright_yellow(&self) -> Painted<&T>
§fn on_bright_blue(&self) -> Painted<&T>
fn on_bright_blue(&self) -> Painted<&T>
§fn on_bright_magenta(&self) -> Painted<&T>
fn on_bright_magenta(&self) -> Painted<&T>
§fn on_bright_cyan(&self) -> Painted<&T>
fn on_bright_cyan(&self) -> Painted<&T>
§fn on_bright_white(&self) -> Painted<&T>
fn on_bright_white(&self) -> Painted<&T>
§fn attr(&self, value: Attribute) -> Painted<&T>
fn attr(&self, value: Attribute) -> Painted<&T>
Enables the styling [Attribute] value.
This method should be used rarely. Instead, prefer to use
attribute-specific builder methods like bold() and
underline(), which have the same functionality
but are pithier.
§Example
Make text bold using attr():
use yansi::{Paint, Attribute};
painted.attr(Attribute::Bold);Make text bold using using bold().
use yansi::Paint;
painted.bold();§fn rapid_blink(&self) -> Painted<&T>
fn rapid_blink(&self) -> Painted<&T>
§fn quirk(&self, value: Quirk) -> Painted<&T>
fn quirk(&self, value: Quirk) -> Painted<&T>
Enables the yansi [Quirk] value.
This method should be used rarely. Instead, prefer to use quirk-specific
builder methods like mask() and
wrap(), which have the same functionality but are
pithier.
§Example
Enable wrapping using .quirk():
use yansi::{Paint, Quirk};
painted.quirk(Quirk::Wrap);Enable wrapping using wrap().
use yansi::Paint;
painted.wrap();§fn clear(&self) -> Painted<&T>
👎Deprecated since 1.0.1: renamed to resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.
fn clear(&self) -> Painted<&T>
resetting() due to conflicts with Vec::clear().
The clear() method will be removed in a future release.§fn whenever(&self, value: Condition) -> Painted<&T>
fn whenever(&self, value: Condition) -> Painted<&T>
Conditionally enable styling based on whether the [Condition] value
applies. Replaces any previous condition.
See the crate level docs for more details.
§Example
Enable styling painted only when both stdout and stderr are TTYs:
use yansi::{Paint, Condition};
painted.red().on_yellow().whenever(Condition::STDOUTERR_ARE_TTY);