use std::fmt;
use std::sync::Arc;
#[derive(Clone, Copy, PartialEq, Eq, PartialOrd, Ord, Hash)]
pub struct RustModuleId {
index: u32,
}
impl RustModuleId {
pub(super) fn new(index: u32) -> Self {
Self { index }
}
pub(in crate::resolution::rust) fn index(&self) -> u32 {
self.index
}
}
impl fmt::Debug for RustModuleId {
fn fmt(&self, formatter: &mut fmt::Formatter<'_>) -> fmt::Result {
write!(formatter, "RustModuleId({})", self.index)
}
}
#[derive(Debug)]
pub struct RustModuleInstance {
pub(super) id: RustModuleId,
pub(super) parent: Option<RustModuleId>,
pub(super) name: Arc<str>,
pub(super) path: Arc<str>,
pub(super) inline: bool,
pub(super) depth: u32,
pub(in crate::resolution::rust) scope: u32,
pub(in crate::resolution::rust) declaration: Option<u32>,
}
impl RustModuleInstance {
pub fn id(&self) -> RustModuleId {
self.id
}
pub fn parent(&self) -> Option<RustModuleId> {
self.parent
}
pub fn name(&self) -> &str {
&self.name
}
pub fn path(&self) -> &str {
&self.path
}
pub fn is_inline(&self) -> bool {
self.inline
}
pub fn depth(&self) -> u32 {
self.depth
}
}