Skip to main content

luaur_analysis/records/
refinement_key.rs

1use alloc::string::String;
2
3/// `DefId` is a `NotNull<const Def>`, which in Rust is represented as a non-null raw pointer to a `Def`.
4pub type DefId = *const core::ffi::c_void;
5
6#[derive(Debug, Clone, PartialEq, Eq, Hash)]
7pub struct RefinementKey {
8    pub(crate) parent: *const RefinementKey,
9    pub(crate) def: DefId,
10    pub(crate) propName: Option<String>,
11}
12
13impl Default for RefinementKey {
14    fn default() -> Self {
15        Self {
16            parent: core::ptr::null(),
17            def: core::ptr::null(),
18            propName: None,
19        }
20    }
21}
22
23#[allow(non_snake_case)]
24impl RefinementKey {
25    pub fn parent(&self) -> *const RefinementKey {
26        self.parent
27    }
28
29    pub fn def(&self) -> DefId {
30        self.def
31    }
32
33    pub fn propName(&self) -> Option<&String> {
34        self.propName.as_ref()
35    }
36}