Add FnAccess methods.

This commit is contained in:
Stephen Chung 2022-07-21 09:33:49 +08:00
parent 747cd903b4
commit 6bc0118074
2 changed files with 22 additions and 0 deletions

View File

@ -32,6 +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.
Version 1.8.0

View File

@ -14,6 +14,27 @@ pub enum FnAccess {
Public,
}
impl FnAccess {
/// Is this function private?
#[inline(always)]
#[must_use]
pub fn is_private(self) -> bool {
match self {
Self::Private => true,
Self::Public => false,
}
}
/// Is this function public?
#[inline(always)]
#[must_use]
pub fn is_public(self) -> bool {
match self {
Self::Private => false,
Self::Public => true,
}
}
}
bitflags! {
/// _(internals)_ Bit-flags containing [`AST`][crate::AST] node configuration options.
/// Exported under the `internals` feature only.