Struct cl_typeck::project::Project

source ·
pub struct Project<'a> {
    pub pool: IndexMap<DefID, Def<'a>>,
    pub anon_types: HashMap<TypeKind, DefID>,
    pub root: DefID,
}

Fields§

§pool: IndexMap<DefID, Def<'a>>§anon_types: HashMap<TypeKind, DefID>

Stores anonymous tuples, function pointer types, etc.

§root: DefID

Implementations§

source§

impl Project<'_>

source

pub fn new() -> Self

source§

impl<'a> Project<'a>

source

pub fn parent_of(&self, module: DefID) -> Option<DefID>

source

pub fn root_of(&self, module: DefID) -> DefID

source

pub fn get<'p>( &self, path: Path<'p>, within: DefID ) -> Option<(Option<DefID>, Option<DefID>, Path<'p>)>

source

pub fn get_type<'p>( &self, path: Path<'p>, within: DefID ) -> Option<(DefID, Path<'p>)>

Resolves a path within a module tree, finding the innermost module. Returns the remaining path parts.

source

pub fn get_value<'p>( &self, path: Path<'p>, within: DefID ) -> Option<(DefID, Path<'p>)>

source

pub fn insert_anonymous_type( &mut self, kind: TypeKind, def: impl FnOnce() -> Def<'a> ) -> DefID

Inserts the type returned by the provided closure iff the TypeKind doesn’t already exist

Assumes kind uniquely identifies the type!

source

pub fn evaluate<T>(&mut self, expr: &T, parent: DefID) -> Result<T::Out, String>

source§

impl<'a> Project<'a>

source

pub fn resolve_imports(&mut self) -> Result<(), String>

source

pub fn visit_def(&mut self, id: DefID) -> Result<(), String>

source

pub fn visit_use(&mut self, u: &'a Use, parent: DefID) -> Result<(), String>

source

pub fn visit_use_tree( &mut self, tree: &'a UseTree, parent: DefID, c: DefID ) -> Result<(), String>

source

pub fn visit_use_path(&mut self) -> Result<(), String>

source

pub fn visit_use_leaf( &mut self, name: &'a Sym, parent: DefID, c: DefID ) -> Result<(), String>

source

pub fn visit_use_alias( &mut self, from: &Sym, name: &Sym, parent: DefID, c: DefID ) -> Result<(), String>

source

pub fn visit_use_glob(&mut self, parent: DefID, c: DefID) -> Result<(), String>

Trait Implementations§

source§

impl<'a> Clone for Project<'a>

source§

fn clone(&self) -> Project<'a>

Returns a copy of the value. Read more
1.0.0 · source§

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

Performs copy-assignment from source. Read more
source§

impl<'a> Debug for Project<'a>

source§

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

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

impl Default for Project<'_>

source§

fn default() -> Self

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

impl<'a> Index<DefID> for Project<'a>

§

type Output = Def<'a>

The returned type after indexing.
source§

fn index(&self, index: DefID) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
source§

impl IndexMut<DefID> for Project<'_>

source§

fn index_mut(&mut self, index: DefID) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more

Auto Trait Implementations§

§

impl<'a> Freeze for Project<'a>

§

impl<'a> RefUnwindSafe for Project<'a>

§

impl<'a> Send for Project<'a>

§

impl<'a> Sync for Project<'a>

§

impl<'a> Unpin for Project<'a>

§

impl<'a> UnwindSafe for Project<'a>

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> ToOwned for T
where T: Clone,

§

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>,

§

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>,

§

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.