Add FnNamespace methods.

This commit is contained in:
Stephen Chung
2022-07-21 09:36:11 +08:00
parent 6bc0118074
commit f85ad28e93
2 changed files with 22 additions and 1 deletions

View File

@@ -32,6 +32,27 @@ pub enum FnNamespace {
Global,
}
impl FnNamespace {
/// Is this a module namespace?
#[inline(always)]
#[must_use]
pub fn is_module_namespace(self) -> bool {
match self {
Self::Internal => true,
Self::Global => false,
}
}
/// Is this a global namespace?
#[inline(always)]
#[must_use]
pub fn is_global_namespace(self) -> bool {
match self {
Self::Internal => false,
Self::Global => true,
}
}
}
/// A type containing all metadata for a registered function.
#[derive(Debug, Clone, Eq, PartialEq, Hash)]
#[non_exhaustive]