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
average
in root module and find nothing, - follow redirects in root module,
- because of redirect
std
, so we look foraverage
instd
, - there is
average
isstd
, - 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_root() -> Module
pub fn new_database() -> Module
pub fn insert( &mut self, fq_ident: Ident, decl: Decl ) -> Result<Option<Decl>, Error>
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)>
sourcepub fn find_by_suffix(&self, suffix: &str) -> Vec<Ident>
pub fn find_by_suffix(&self, suffix: &str) -> Vec<Ident>
Recursively finds all declarations that end in suffix.
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
source§impl PartialEq<Module> for Module
impl PartialEq<Module> for Module
impl StructuralPartialEq for Module
Auto Trait Implementations§
impl RefUnwindSafe for Module
impl Send for Module
impl Sync for Module
impl Unpin for Module
impl UnwindSafe for Module
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more