pub enum Callee {
Show 28 variants
Fn(Arc<FnDecl>, Vec<TyId>),
FnValue(Arc<FnDecl>, Vec<TyId>),
Value(String),
Ctor {
sum: Arc<TypeDecl>,
tag: String,
},
Refine(Arc<TypeDecl>),
Unsafe(Arc<TypeDecl>),
Static(Arc<FnDecl>, Vec<TyId>),
Method(Arc<FnDecl>, Vec<TyId>),
Kernel {
recv: TyId,
op: KernelOp,
},
SignedCookie {
actor: String,
issue: bool,
},
CookieField {
record: String,
field: String,
expire: bool,
},
Intrinsic {
ns: IntrinsicNs,
op: StaticOp,
},
Fault {
kind: &'static str,
},
Capability {
cap: String,
op: String,
wire: Option<Arc<CapEncoding>>,
first_party: Option<FirstPartyCap>,
event: Option<String>,
},
D1Select {
cap: String,
row: TyId,
sql: String,
first: bool,
pg: bool,
mysql: bool,
},
D1Sql(D1SqlSite),
D1Peek {
participant: String,
binding: String,
local: String,
},
D1Decode(D1DecodeSite),
CrossCap {
unit: String,
cap: String,
op: String,
wire: Option<Arc<CapEncoding>>,
first_party: Option<FirstPartyCap>,
},
Cross {
unit: String,
service: String,
},
AgentInit(String),
Agent {
agent: String,
handler: String,
},
TestService {
service: String,
address: HandlerAddress,
extra_headers: bool,
},
TestAssetFetch {
service: String,
},
Store {
field: String,
op: StoreEntryOp,
},
Query {
field: String,
op: StoreQueryOp,
role: QueryRole,
},
Const(String, Option<Box<D1SqlSite>>),
Principal(CallSitePrincipal),
}Expand description
P6.0 (design/tracks/the-ir.md §6, #1139): a resolved classification of a
call-shaped expression, recorded once by the checker’s own dispatch
(checker::calls) rather than re-derived by each later consumer —
closing R6.10’s duplicated-classification gap between bynk-check and
bynk-emit’s lower_method_call/lower_call.
Adapted to the identity handles this checker already has (Decision A,
ADR 0333, the-ir-callee-in-bynk-check) rather than the reference
document’s DefId/LocalId/VariantId/OpId arena — none of which
exists here, since the Resolve phase that would mint them was never
built (project-model.md §3.4 deferred it to phase 8).
Arc<FnDecl>/Arc<TypeDecl> are already-cheap resolved handles
(ResolvedCommons::fns/types); every other variant’s identity is a
name, exactly as the checker already keys capabilities, store fields,
units, and agents.
Recorded at each dispatch decision as soon as it is known — including on an error sub-branch (an arity mismatch, an undeclared capability) — since the kind of call is fixed by dispatch, not by whether it went on to type-check cleanly.
Variants§
Fn(Arc<FnDecl>, Vec<TyId>)
A free function call. The Vec<TyId> is the call’s comparator witnesses
(constrained-generics slice 1): the type argument of each Ord-bounded
type parameter of the callee, in codable::witness_list order.
Empty for a callee with no Ord bound, which is almost every call.
FnValue(Arc<FnDecl>, Vec<TyId>)
A generic function with Ord bounds named as a value (xs.map(max)),
instantiated at the reference: its witnesses, as for Callee::Fn.
Value(String)
Applying a function-typed local or parameter (f(x) where f is in
scope, not declared). No stable id exists for a local beyond its
name — the reference’s LocalId presumes the same Resolve phase
Decision A declines to build here.
Ctor
Sum-variant construction, bare (Some(x)) or qualified
(Opt.Some(x)).
Refine(Arc<TypeDecl>)
T.of(value) — the refined/opaque runtime constructor.
Unsafe(Arc<TypeDecl>)
T.unsafe(value) — the opaque constructor, defining-unit only.
Static(Arc<FnDecl>, Vec<TyId>)
A user-declared static method (Type.method(...)). The Vec<TyId> is
the call’s witnesses, as for Callee::Fn (constrained generics
slice 4); empty for a static on a non-generic type.
Method(Arc<FnDecl>, Vec<TyId>)
A user-declared instance method (UFCS), generic or not. The Vec<TyId>
is the call’s comparator witnesses, as for Callee::Fn.
Kernel
A built-in method on a value — the collection/query/stream/
connection/numeric/duration/instant/bytes/string/option/result/
effect kernels, including the refined-receiver fallback (ADR 0168).
recv is the receiver’s own checked type; op is the resolved
operation on it (#3164), so a consumer matches on the enum rather than
on the method’s spelling.
SignedCookie
#3386: Actor.issue(identity) / Actor.expire() on a local SignedCookie
actor: the session cookie the actor mints, or its matching deletion.
issue reads the Clock and is an Effect; expire is pure.
CookieField
#3446: Record.field.cookie(value) / Record.field.expire() on a cookie record: the
Cookie the field’s decoder reads back (named by its wire name, valued by the decoder’s
leaf rules), or its matching deletion.
Intrinsic
A built-in static constructor with no declaring type — List.empty,
Map.empty, Int.parse/Float.parse, Duration.millis,
Instant.fromEpochMillis, Bytes.fromUtf8/fromBase64/empty,
Json.decode/encode, Stream.of.
ns and op (1A.33, Decision B) are closed: built only for a method the namespace
has, so an unknown method gets no callee. Build one with Callee::intrinsic.
Fault
#2620: unreachable(msg) / todo(msg) — the ambient built-ins that
fault when evaluated. kind is the runtime fault kind (Unreachable /
Todo); the call’s type is Ty::Never.
Capability
A same-context capability operation call (Cap.op(...)). wire is set
for an operation with Codable parameters: how the call encodes them.
Fields
wire: Option<Arc<CapEncoding>>first_party: Option<FirstPartyCap>1A.33 (Decision A): which first-party capability this is, when it is
bynk’s own (crate::firstparty::resolve); None for any other
capability, including a same-named one from another unit (#934).
D1Select
#2865: Cap.select[T](tail, params) / Cap.firstAs[T](tail, params) on
a derived D1 instance. Not a declared operation: the compiler writes
sql (the column list from the row T, then the literal tail) and
lowers over all/first and the decodeSql codec.
Fields
D1Sql(D1SqlSite)
#3070: a literal SQL statement of a derived D1 instance, recorded under
the SQL argument’s id (not the call’s, which keeps its own entry), so
the project phase can prepare it against the binding’s migrations.
D1Peek
#3147: D1.peek(<participant>.<Cap>). The case holds a capability over
the participant’s test database, on the binding of its env, as
deps.<local>; calls on the handle are capability calls on local.
D1Decode(D1DecodeSite)
#3139: a Json.decodeSql[T](x) whose x is the rows of a literal D1 read,
recorded under the argument’s id, so the project phase can check T’s
fields against the statement’s result columns.
CrossCap
A cross-context capability operation call (B.Cap.op(...) /
Alias.Cap.op(...)).
Fields
wire: Option<Arc<CapEncoding>>first_party: Option<FirstPartyCap>1A.33 (Decision A): which first-party capability unit.cap is, when it is
bynk’s own.
Cross
A cross-context service call (B.service(...) / Alias.service(...)).
AgentInit(String)
AgentName(key) — agent instance construction. No slot exists for
this in the reference’s own Callee taxonomy (Part 6.5 only names
handler dispatch); added here since this slice covers every call
shape check_call dispatches, not only the ones the reference
anticipated.
Agent
agent.handler(args) — agent handler dispatch.
TestService
A test-body service address (svc.call/svc.<VERB>("/path", …)/
svc.schedule(...)/svc.message(...)). check_test_service_address
always returns None by design (the runner recovers the outcome
type at runtime) — this classification exists purely for a later
consumer (e.g. go-to-definition on the address), not typing.
extra_headers (#2910): a trailing RequestHeaders argument sent to a
route that declares no headers: parameter — a system-tier-only form.
address (1A.33, Decision D) is typed: where the address is aimed.
TestAssetFetch
#1883, slice 3: svc.GET(asset) in a test body — an asset fetch,
answered by the asset tier rather than a handler. Its own variant
(review of #1922) so no route address can be mistaken for it.
Store
An effectful <field>.<op>(…) storage operation on a store
Map/Set/Cache/Log/Cell field — R6.5’s own named target
(P6.2, #1143): a mutation detector keyed on this variant, not a
receiver’s bare name, cannot miss a mutation reached through a
non-Ident receiver or false-negative on a shadowed local, the
defect class block_writes_state’s mutating_op still carries.
field is the store field’s own name (no FieldId arena exists —
same adaptation check_store_*_op’s own lookups already use). Note
this is recorded outside calls.rs’s six functions — the
store-field ladder lives directly in checker.rs’s own type_of,
never reaching any of them — extending P6.0’s own recording surface
past the boundary its “Done when” deliberately drew.
op (1A.33, Decision C) is typed, built only for an operation the field’s kind has.
Query
A query builder/terminal call that lifts a bare store Map/Log
field into a lazy Query[V] (is_query_op’s own gate,
checker.rs’s type_of) — R6.12’s own named target (P6.2, #1143).
field names the store field being lifted — without it, a chain
rooted at this call (orders.filter(p).count()) would carry no
identity for orders anywhere in the classification, the same
information loss R6.5 exists to close on the write side. role is
read back from the checker’s own typing decision for this exact call
(Ty::Query(_) result ⇒ Builder, anything else ⇒ Terminal), not
a second name-list classifier alongside is_query_op’s. A chained
builder/terminal call on an already-Query-typed receiver
(.filter(p).count()’s own .count()) is not this variant — it
reaches check_method_call’s ordinary kernel dispatch and is
Callee::Kernel already (P6.0); Query here exists only because the
lift call’s own outer expression never passes through any of
calls.rs’s six functions to get one.
op (1A.33, Decision C) is typed.
Const(String, Option<Box<D1SqlSite>>)
#2617: a bare name that resolves to a const (one of this unit’s, a
sibling file’s or a usesd commons’), not a local of the same name.
Not call-shaped in the source, but emitted as one: each constant is a
hoisted, cached function (Name()), so the lowering must know which
idents name a constant, and only the checker’s scope walk can tell a
constant from a local that shadows it. Recorded like the bare
HttpResult variant reference (Callee::Intrinsic).
#3108: when the name is a D1 call’s SQL argument, the second field keeps
that statement’s Callee::D1Sql site, which this entry would
otherwise replace (one id, one entry), so the constant’s SQL is still
prepared.
Principal(CallSitePrincipal)
1A.33: what a call-site principal clause (by Nobody, by Forged, by User("bob"))
is, recorded under the clause’s own CallSiteActor::id. Not call-shaped: it is the
one place the reserved principal names are classified, for the checker’s own rules
and the emitter alike.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Callee
impl RefUnwindSafe for Callee
impl Send for Callee
impl Sync for Callee
impl Unpin for Callee
impl UnsafeUnpin for Callee
impl UnwindSafe for Callee
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);