#[non_exhaustive]pub struct Enabled {}Expand description
Token indicating that beta feature(s) are or can be enabled
When adding a new beta feature:
-
Put an instance of
beta::Enabledin the appropriate piece of parsed template syntax, For example, in theSubstDetailsalong with theO::markers. -
When parsing, obtain the value from
Enabled::new_for_syntax. -
Add a test case to
tests/minimal-ui/disabled.rswhich omits thebeta_deftlyoption, and therefore fails, thus demonstrating that the feature gate works as intended.
Implementations§
Source§impl Enabled
impl Enabled
Sourcepub fn new_for_dd_option(_: Span) -> Result<Self>
pub fn new_for_dd_option(_: Span) -> Result<Self>
If the cargo feature is enabled, return Ok(Enabled)
Used when parsing the beta_deftly template option.
Sourcepub fn new_for_modules_feature(_: Span) -> Result<Self>
pub fn new_for_modules_feature(_: Span) -> Result<Self>
If the cargo feature is enabled, return Ok(Enabled)
Used for things that are inherently part of the modules feature,
such as uses and define_derive_deftly_module!.
Sourcepub fn new_for_imported_definitions() -> Result<Enabled, &'static (dyn Fn(Span) -> Error + 'static)>
pub fn new_for_imported_definitions() -> Result<Enabled, &'static (dyn Fn(Span) -> Error + 'static)>
If the cargo feature is enabled, return Some.
Used when parsing template text imported from modules.
The rule is that modules have their own beta_deftly option,
and beta features are allowed in module text iff the module
enabled them. The importing template doesn’t need to.
Sourcepub fn new_for_syntax(span: Span) -> Result<Self>
pub fn new_for_syntax(span: Span) -> Result<Self>
If the beta_deftly template feature is enabled, return Ok(Enabled)
Used when parsing beta syntax, in templates.
Trait Implementations§
impl Copy for Enabled
impl Eq for Enabled
impl StructuralPartialEq for Enabled
Auto Trait Implementations§
impl Freeze for Enabled
impl RefUnwindSafe for Enabled
impl Send for Enabled
impl Sync for Enabled
impl Unpin for Enabled
impl UnwindSafe for Enabled
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more