mirror of
https://github.com/rust-lang/rust-analyzer
synced 2025-01-07 18:58:51 +00:00
26 lines
702 B
Rust
26 lines
702 B
Rust
use ra_db::{CrateId, Cancelable};
|
|
|
|
use crate::{Module, Name, db::HirDatabase};
|
|
|
|
/// hir::Crate describes a single crate. It's the main inteface with which
|
|
/// crate's dependencies interact. Mostly, it should be just a proxy for the
|
|
/// root module.
|
|
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
|
|
pub struct Crate {
|
|
pub(crate) crate_id: CrateId,
|
|
}
|
|
|
|
#[derive(Debug)]
|
|
pub struct CrateDependency {
|
|
pub krate: Crate,
|
|
pub name: Name,
|
|
}
|
|
|
|
impl Crate {
|
|
pub fn dependencies(&self, db: &impl HirDatabase) -> Vec<CrateDependency> {
|
|
self.dependencies_impl(db)
|
|
}
|
|
pub fn root_module(&self, db: &impl HirDatabase) -> Cancelable<Option<Module>> {
|
|
self.root_module_impl(db)
|
|
}
|
|
}
|