pub enum IrHandlerKind {
Call,
Http {
method: IrHttpMethod,
path: String,
},
Cron {
expr: String,
},
Message,
Open,
Close,
Event,
}Expand description
P6.9’s real IrHandler ([DECISION C], #1167) — an agent on call
handler’s own resolved shape, bynk_lower::lower_handler_ir’s own return
value. Six of the reference’s own eight sketched fields are its
verbatim shape (bynk-greenfield-compiler.md:1169-1177) under this module’s
already-established substitutions: kind: IrHandlerKind — originally
HandlerKind reused verbatim from bynk_syntax::ast (the same “reused,
not adapted” treatment IrExprKind::Call’s own Callee payload got),
converted to a real IR-native mirror by P6.24a once a purely-structural
emitter reader (no body, no IrItem::Service) needed to match on it
without spelling bynk_syntax::ast — see IrHandlerKind’s own doc
comment; params/
given are this module’s standard “no arena” substitution (params: Vec<(String, TyId)> mirrors IrItem::Fn::params exactly; given: Vec<String> reads each CapRef::key(), the same identity
Callee::Capability already uses); binder: Option<ActorBinder> per
ActorBinder’s own doc comment; body: IrExpr is
bynk_lower::lower_handler_ir’s own new handler-body lowering entry point
(parallel to, but distinct from, bynk_lower::lower_fn_body_ir — that
entry point’s own doc comment names exactly why a handler body cannot
reuse it); commit: CommitShape calls bynk_lower::lower_commit_shape_ir
(P6.8, unchanged); effectful: bool reuses IrItem::Fn::effectful’s
own derivation (Ty::Fn’s doc: effectful iff ret is Effect[_])
unchanged.
method_name: Option<String> is added beyond the reference’s own
sketch — the same class of addition #1162’s own review made for
IrItem::Fn::receiver (#1161): the reference sketch has no slot for a
handler’s own declared name at all, but a future printer (or R8.10’s own
handler-key mangling) structurally needs it to know which of an
agent’s several on call <name> handlers this is. None for the shapes
that have none today (a service’s bare on call).
actors: Vec<String> is a second addition beyond the reference’s own
sketch (review of #1171/#1180) — the actor name(s) a by clause
itself names, read directly from h.by_clause.as_ref().map(|by| &by.actors) rather than from binder. Needed because binder alone
cannot represent the gate: a binder-less by <Actor> (verify-and-
discard, ByClause::binder: Option<Ident>) resolves to binder: None
with nothing else distinguishing it from a handler with no by clause
at all, and the same erasure hits a binder that shadowed a param and
was suppressed (context_checks.rs:2050-2055) — in both cases the
authorization gate is real even though no identity got bound to a
local. Even the happy path loses information a single-actor binder
alone can’t recover: ActorBinder::ty is Ty::Actor(identity_ty),
which carries the sealed identity type, not the actor’s own
declared name — by u: Buyer and by u: Seller sharing one identity
type would otherwise lower to byte-identical ActorBinders. The sum
path already avoids this (Ty::ActorSum(Vec<(String, TyId)>) retains
member names); actors gives the single-actor and no-binder cases the
same guarantee, uniformly, mirroring IrHandler::given’s own “read
straight off the AST, not through any checker-persisted resolution”
shape. Empty for an agent handler unconditionally — the same
bynk.actor.by_on_agent guarantee [DECISION D] already grounds for
binder.
bynk_lower::lower_handler_ir is agent-only by design, still ([DECISION
D]) — a real service handler’s IrHandler (specifically, a non-None
binder) is never constructed by this function, and that stays true
even now that #1170 persisted handler_actor_binding’s own resolved
(String, TyId) into TypedCommons::actor_bindings/CheckedProgram.
P6.11 (#1171) built the real service-handler path as a sibling,
bynk_lower::lower_service_handler_ir, not a widening of this one —
bynk_lower::lower_handler_ir’s own doc comment names exactly why
(disjoint scopes, and widening would delete the by_clause.is_none()
assertion that today catches a service handler reaching the wrong
entry point). Not a functional gap for R6.16’s own claim (invocation
origin-independence is specifically about an agent handler): an agent
handler’s own binder is None unconditionally and by construction —
bynk.actor.by_on_agent (context_checks.rs:2986-2996) rejects any
by clause on an agent handler outright, so bynk_lower::lower_handler_ir
never has one to lower in the first place.
P6.24a: an IR-native mirror of bynk_syntax::ast::HandlerKind — a
field-for-field copy, not a re-export. Every field (HttpMethod, a
route path: String, a cron expr: String) is already fully resolved
at parse time; nothing here ever needed TyId/CheckedProgram, so
bynk_lower::lower_handler_kind_ir is a pure, unconditional conversion —
unlike almost everything else in this module, it carries no ADR 0334
totality story because it can never fail to resolve.
Exists because IrHandler::kind was still typed as the raw AST enum
(confirmed live, #1184’s own review) — the one field on an otherwise
fully IR-native struct that still forced any reader down to
bynk_syntax::ast for a check as simple as “is this an HTTP handler.”
R6.16 (handler-invocation origin-independence, P6.9) is this type’s own
real destination; giving emitter.rs’s several purely-structural
HandlerKind/ServiceProtocol scans (no body needed, no IrItem:: Service required) somewhere IR-native to route through first is what
this slice actually lands.
Variants§
Trait Implementations§
Source§impl Clone for IrHandlerKind
impl Clone for IrHandlerKind
Source§fn clone(&self) -> IrHandlerKind
fn clone(&self) -> IrHandlerKind
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for IrHandlerKind
impl Debug for IrHandlerKind
Source§impl PartialEq for IrHandlerKind
impl PartialEq for IrHandlerKind
impl Eq for IrHandlerKind
impl StructuralPartialEq for IrHandlerKind
Auto Trait Implementations§
impl Freeze for IrHandlerKind
impl RefUnwindSafe for IrHandlerKind
impl Send for IrHandlerKind
impl Sync for IrHandlerKind
impl Unpin for IrHandlerKind
impl UnsafeUnpin for IrHandlerKind
impl UnwindSafe for IrHandlerKind
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<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§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);