pub struct MethodEntry {
pub receiver: TypePattern,
pub name: &'static str,
pub params: Vec<TypePattern>,
pub result: TypePattern,
pub purity: Purity,
pub lowering: MethodLowering,
pub doc: &'static str,
}Expand description
One row of the method catalog (§16.2 fields).
Fields§
§receiver: TypePatternThe receiver shape the method is defined on, e.g. Vec[T].
name: &'static strThe method name, e.g. push.
params: Vec<TypePattern>Parameter type patterns, positional.
result: TypePatternResult type pattern.
purity: PurityWhether the method is pure.
lowering: MethodLoweringHow the method lowers.
doc: &'static strOne-line documentation, surfaced in hover.
Implementations§
Source§impl MethodEntry
impl MethodEntry
Sourcepub fn arity(&self) -> usize
pub fn arity(&self) -> usize
The arity (number of explicit parameters, excluding the receiver).
Sourcepub fn allocates(&self) -> bool
pub fn allocates(&self) -> bool
Whether calling this method may allocate, and so whether its call site is a GC safepoint.
Derived from the ABI manifest, not restated per row: a row that carried its own answer could disagree with the wrapper it lowers to. An intrinsic has no wrapper — the MIR lowering it expands to carries its own per-instruction effects.
Sourcepub fn can_fault(&self) -> bool
pub fn can_fault(&self) -> bool
Whether calling this method may raise a runtime fault (§9.1), and so whether its call site needs a fault check after it.
Derived, for the same reason as MethodEntry::allocates: a per-row
field would be a second statement of the manifest’s answer, free to
drift — a bitset_insert row claiming it cannot fault beside a
praxis_bitset_insert that raises InvalidSize for a member outside
BitIndex’s range. MIR’s own Inst::can_fault reads the same manifest
row, so the check lowering emits and this answer agree by construction.
Sourcepub fn bounds(&self) -> Vec<(&'static str, Bound)>
pub fn bounds(&self) -> Vec<(&'static str, Bound)>
What each of this entry’s type variables must be, by name.
A bound is a fact about the variable, not about the position it is
written in, so this sweeps the receiver, the parameters and the result and
reports each name once. That is why Vec[T].sum() can declare its Int
requirement on the receiver’s element and have it apply — there is nowhere
else in the row for it to live.
A name that declares the same bound twice is one requirement.
MethodCatalogBuilder::finish refuses two different ones, so the
dedup here cannot hide a contradiction.
Trait Implementations§
Source§impl Clone for MethodEntry
impl Clone for MethodEntry
Source§fn clone(&self) -> MethodEntry
fn clone(&self) -> MethodEntry
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more