Skip to main content

ResolvedModule

Struct ResolvedModule 

Source
pub struct ResolvedModule {
    pub name: String,
    pub functions: BTreeMap<String, FnEntry>,
    pub methods: BTreeMap<(String, String), FnEntry>,
    pub structs: BTreeMap<String, StructEntry>,
    pub enums: BTreeMap<String, EnumEntry>,
    pub traits: BTreeMap<String, TraitEntry>,
    pub conformances: BTreeMap<(String, String), Conformance>,
    pub aliases: BTreeMap<String, AliasEntry>,
    pub host_uses: BTreeSet<String>,
    pub host_items: BTreeMap<String, String>,
    pub imports: BTreeMap<String, String>,
    pub module_imports: BTreeMap<String, String>,
}
Expand description

Everything one module declares.

Fields§

§name: String§functions: BTreeMap<String, FnEntry>

Free functions, keyed by name.

§methods: BTreeMap<(String, String), FnEntry>

Methods and associated functions, keyed by (type name, function name).

§structs: BTreeMap<String, StructEntry>§enums: BTreeMap<String, EnumEntry>§traits: BTreeMap<String, TraitEntry>§conformances: BTreeMap<(String, String), Conformance>

Every declared conformance, keyed by (trait name, type name).

§aliases: BTreeMap<String, AliasEntry>§host_uses: BTreeSet<String>

Host modules named by use, such as console from use console.println.

§host_items: BTreeMap<String, String>

Names imported unqualified by use, such as println -> console.

§imports: BTreeMap<String, String>

Declarations imported from another module of the package, mapping the name they are visible under — the use path’s last segment, which is the declaration’s own name — to the module that declares them.

Only exported declarations ever appear here; a use naming a module-private one is rejected.

§module_imports: BTreeMap<String, String>

Modules imported whole, mapping the name they are visible under — the use path’s last segment — to the full module name, so their exports can be reached qualified as booking.createBooking.

Implementations§

Source§

impl ResolvedModule

Source

pub fn owner_of<'a>(&'a self, name: &str) -> Option<&'a str>

The module that declares name as this module sees it: itself when it declares name, and the module name was imported from otherwise.

A local declaration wins, which is only reachable when a conflicting import was already reported: resolve refuses a use that binds a name this module also declares.

Source

pub fn exported(&self, name: &str) -> Option<bool>

Whether this module’s declaration of name is exported, or None when it declares no name.

A method is not a declaration in this sense: it is reached through its type, so the type’s visibility is what governs it.

Source

pub fn exports(&self) -> Vec<String>

Every name this module exports, in name order.

Source

pub fn dependencies(&self) -> BTreeSet<&str>

Every module this one imports from, whether by declaration or whole.

Trait Implementations§

Source§

impl Debug for ResolvedModule

Source§

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

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

impl Default for ResolvedModule

Source§

fn default() -> ResolvedModule

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 = 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.