CrateStore in rustc_session::cstore - Rust
Description: A store of Rust crates, through which their metadata can be accessed.

Skip to main content

## CrateStore

# Trait CrateStore

Source

    pub trait CrateStore: Debug {
        // Required methods
        fn as_any(&self) -> &dyn Any;
        fn untracked_as_any(&mut self) -> &mut dyn Any;
        fn def_key(&self, def: DefId) -> DefKey;
        fn def_path(&self, def: DefId) -> DefPath;
        fn def_path_hash(&self, def: DefId) -> DefPathHash;
        fn crate_name(&self, cnum: CrateNum) -> Symbol;
        fn stable_crate_id(&self, cnum: CrateNum) -> StableCrateId;
    }

Expand description

A store of Rust crates, through which their metadata can be accessed.

Note that this trait should probably not be expanding today. All new functionality should be driven through queries instead!

If you find a method on this trait named `{name}_untracked` it signifies that it’s not tracked for dependency information throughout compilation (it’d break incremental compilation) and should only be called pre-HIR (e.g. during resolve)

## Required Methods§

Source

#### fn as_any(&self) -> &dyn Any

Source

#### fn untracked_as_any(&mut self) -> &mut dyn Any

Source

#### fn def_key(&self, def: DefId) -> DefKey

Source

#### fn def_path(&self, def: DefId) -> DefPath

Source

#### fn def_path_hash(&self, def: DefId) -> DefPathHash

Source

#### fn crate_name(&self, cnum: CrateNum) -> Symbol

Source

#### fn stable_crate_id(&self, cnum: CrateNum) -> StableCrateId

## Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

## Implementors§