Skip to main content

Crate

Struct Crate 

Source
pub struct Crate {
    pub files: Vec<SourceFile>,
    pub diagnostics: Vec<LoadDiagnostic>,
    pub structs: HashMap<String, StructDef>,
    pub methods: HashMap<(String, String), ImplFn>,
    pub functions: HashMap<String, ImplFn>,
    pub qualified_structs: HashMap<String, StructDef>,
    pub qualified_methods: HashMap<(String, String), ImplFn>,
    pub qualified_functions: HashMap<String, ImplFn>,
    pub public_reexports: Vec<PublicReexport>,
    pub imports: Vec<ImportBinding>,
    pub dependency_aliases: HashMap<String, String>,
    /* private fields */
}

Fields§

§files: Vec<SourceFile>§diagnostics: Vec<LoadDiagnostic>

Filesystem and parse failures retained as structured incomplete-analysis evidence.

§structs: HashMap<String, StructDef>

Legacy bare-name map. When names collide, deterministic source traversal preserves the historical last-definition-wins behavior. Use struct_candidates for new analysis.

§methods: HashMap<(String, String), ImplFn>

(type_name, fn_name) -> method.

§functions: HashMap<String, ImplFn>

Free functions by name, for fn build_encoder(vb: VarBuilder) -> .. helpers.

§qualified_structs: HashMap<String, StructDef>

Exact qualified identities. These maps make unambiguous lookups cheap.

§qualified_methods: HashMap<(String, String), ImplFn>§qualified_functions: HashMap<String, ImplFn>§public_reexports: Vec<PublicReexport>§imports: Vec<ImportBinding>§dependency_aliases: HashMap<String, String>

Rust crate identifier to Cargo package name, including dependency renames.

Implementations§

Source§

impl Crate

Source

pub fn all_structs(&self) -> impl Iterator<Item = &StructDef>

Every struct definition, including colliding and cfg-gated alternatives.

Source

pub fn all_methods(&self) -> impl Iterator<Item = &ImplFn>

Every inherent method, including colliding and cfg-gated alternatives.

Source

pub fn all_functions(&self) -> impl Iterator<Item = &ImplFn>

Every free function, including colliding and cfg-gated alternatives.

Source

pub fn field_type(&self, struct_name: &str, field: &str) -> Option<&TypeRef>

Source

pub fn file_label(&self, span: SrcSpan) -> String

Source

pub fn struct_candidates(&self, name: &str) -> Vec<&StructDef>

All structs matching either a bare or exact qualified name, sorted by qualified identity and source location. Unlike the legacy map, collisions are never discarded.

Source

pub fn function_candidates(&self, name: &str) -> Vec<&ImplFn>

All free functions matching either a bare or exact qualified name.

Source

pub fn method_candidates(&self, type_name: &str, fn_name: &str) -> Vec<&ImplFn>

All inherent methods matching a bare or qualified owner and a function name.

Source

pub fn reexport_candidates(&self, name: &str) -> Vec<&PublicReexport>

Public re-export leaves matching a bare binding or exact qualified binding.

Source

pub fn resolve_import_path( &self, module_path: &str, segments: &[String], ) -> Vec<String>

Resolve a source path through an explicit use binding in the containing module.

Source

pub fn resolve_unambiguous_import_path( &self, segments: &[String], ) -> Vec<String>

Resolve an alias when every binding of that spelling agrees on the same external target. This is used by legacy structure extraction where the current inline module is not carried through the compact arena.

Source

pub fn set_dependency_aliases( &mut self, aliases: impl IntoIterator<Item = (String, String)>, )

Trait Implementations§

Source§

impl Default for Crate

Source§

fn default() -> Crate

Returns the “default value” for a type. Read more

Auto Trait Implementations§

§

impl !Send for Crate

§

impl !Sync for Crate

§

impl Freeze for Crate

§

impl RefUnwindSafe for Crate

§

impl Unpin for Crate

§

impl UnsafeUnpin for Crate

§

impl UnwindSafe for Crate

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.