Struct prql_compiler::semantic::Module
source · pub struct Module {
pub redirects: Vec<Ident>,
pub shadowed: Option<Box<Decl>>,
/* private fields */
}Fields§
§redirects: Vec<Ident>List of relative paths to include in search path when doing lookup in this module.
Assuming we want to lookup average, which is in std. The root module
does not contain the average. So instead:
- look for
averagein root module and find nothing, - follow redirects in root module,
- because of redirect
std, so we look foraverageinstd, - there is
averageisstd, - result of the lookup is FQ ident
std.average.
shadowed: Option<Box<Decl>>A declaration that has been shadowed (overwritten) by this module.
Implementations§
source§impl Module
impl Module
pub fn singleton<S: ToString>(name: S, entry: Decl) -> Module
pub fn new() -> Module
pub fn insert(&mut self, ident: Ident, entry: Decl) -> Result<Option<Decl>>
pub fn get_mut(&mut self, ident: &Ident) -> Option<&mut Decl>
sourcepub fn get(&self, fq_ident: &Ident) -> Option<&Decl>
pub fn get(&self, fq_ident: &Ident) -> Option<&Decl>
Get namespace entry using a fully qualified ident.
pub fn lookup(&self, ident: &Ident) -> HashSet<Ident>
pub fn shadow(&mut self, ident: &str)
pub fn unshadow(&mut self, ident: &str)
pub fn stack_push(&mut self, ident: &str, namespace: Module)
pub fn stack_pop(&mut self, ident: &str) -> Option<Module>
pub fn as_decls(&self) -> Vec<(Ident, &Decl)>
Trait Implementations§
source§impl<'de> Deserialize<'de> for Module
impl<'de> Deserialize<'de> for Module
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where __D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more