Skip to main content

MethodEntry

Struct MethodEntry 

Source
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: TypePattern

The receiver shape the method is defined on, e.g. Vec[T].

§name: &'static str

The method name, e.g. push.

§params: Vec<TypePattern>

Parameter type patterns, positional.

§result: TypePattern

Result type pattern.

§purity: Purity

Whether the method is pure.

§lowering: MethodLowering

How the method lowers.

§doc: &'static str

One-line documentation, surfaced in hover.

Implementations§

Source§

impl MethodEntry

Source

pub fn arity(&self) -> usize

The arity (number of explicit parameters, excluding the receiver).

Source

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.

Source

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.

Source

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

Source§

fn clone(&self) -> MethodEntry

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for MethodEntry

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.