Skip to main content

Module

Struct Module 

Source
pub struct Module {
    pub sums: Vec<SumType>,
    pub records: Vec<RecordType>,
    pub traits: Vec<TraitDef>,
    pub impls: Vec<ImplInfo>,
    pub functions: Vec<Function>,
    pub externs: Vec<ExternFn>,
}
Expand description

A fully checked module: type layouts plus typed functions.

Fields§

§sums: Vec<SumType>§records: Vec<RecordType>§traits: Vec<TraitDef>§impls: Vec<ImplInfo>§functions: Vec<Function>§externs: Vec<ExternFn>

extern (FFI) function declarations reachable in the program.

Implementations§

Source§

impl Module

Source

pub fn extern_fn(&self, def_id: DefId) -> Option<&ExternFn>

Find the extern function declared under def_id, if any.

Source

pub fn sum(&self, def_id: DefId) -> Option<&SumType>

Find the sum type declared under def_id, if any.

Source

pub fn record(&self, def_id: DefId) -> Option<&RecordType>

Find the record type declared under def_id, if any.

Source

pub fn trait_def(&self, def_id: DefId) -> Option<&TraitDef>

Find the trait declared under def_id, if any.

Source

pub fn function(&self, def_id: DefId) -> Option<&Function>

Find the function declared under def_id, if any.

Source

pub fn resolve_method_full( &self, trait_id: DefId, method: u32, self_ty: &Ty, ) -> Option<(DefId, Vec<Ty>)>

Resolve trait method method (index into the trait’s methods) for a concrete self type to the compiled function it should dispatch to, paired with the type arguments that function must be instantiated with:

  • if the matching impl provides the method, dispatch to it, instantiated with the impl’s own type arguments recovered from self_ty (impl<T> Show for Box<T> called on Box<Int> → [Int]);
  • otherwise dispatch to the trait’s default body, which is generic over Self → [self_ty].

Returns None if no impl of the trait fits self_ty.

Trait Implementations§

Source§

impl Debug for Module

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Default for Module

Source§

fn default() -> Self

Returns the “default value” for a type. 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> 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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.