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
impl Module
Sourcepub fn extern_fn(&self, def_id: DefId) -> Option<&ExternFn>
pub fn extern_fn(&self, def_id: DefId) -> Option<&ExternFn>
Find the extern function declared under def_id, if any.
Sourcepub fn sum(&self, def_id: DefId) -> Option<&SumType>
pub fn sum(&self, def_id: DefId) -> Option<&SumType>
Find the sum type declared under def_id, if any.
Sourcepub fn record(&self, def_id: DefId) -> Option<&RecordType>
pub fn record(&self, def_id: DefId) -> Option<&RecordType>
Find the record type declared under def_id, if any.
Sourcepub fn trait_def(&self, def_id: DefId) -> Option<&TraitDef>
pub fn trait_def(&self, def_id: DefId) -> Option<&TraitDef>
Find the trait declared under def_id, if any.
Sourcepub fn function(&self, def_id: DefId) -> Option<&Function>
pub fn function(&self, def_id: DefId) -> Option<&Function>
Find the function declared under def_id, if any.
Sourcepub fn resolve_method_full(
&self,
trait_id: DefId,
method: u32,
self_ty: &Ty,
) -> Option<(DefId, Vec<Ty>)>
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 onBox<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§
Auto Trait Implementations§
impl Freeze for Module
impl RefUnwindSafe for Module
impl Send for Module
impl Sync for Module
impl Unpin for Module
impl UnsafeUnpin for Module
impl UnwindSafe for Module
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
Mutably borrows from an owned value. Read more