diff --git a/CHANGELOG.md b/CHANGELOG.md index 6c4128e1..9a9954b8 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -32,7 +32,7 @@ Enhancements * `EvalContext::eval_expression_tree_raw` and `Expression::eval_with_context_raw` are added to allow for not rewinding the `Scope` at the end of a statements block. * A new `range` function variant that takes an exclusive range with a step. * `as_string` is added to BLOB's to convert it into a string by interpreting it as a UTF-8 byte stream. -* `FnAccess::is_private` and `FnAccess::is_public` are added for convenience. +* `FnAccess::is_private`, `FnAccess::is_public`, `FnNamespace::is_module_namespace` and `FnNameSpace::is_global_namespace` are added for convenience. Version 1.8.0 diff --git a/src/module/mod.rs b/src/module/mod.rs index 18d996c1..38bb887a 100644 --- a/src/module/mod.rs +++ b/src/module/mod.rs @@ -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]