Struct deluxe_core::Flag
source · pub struct Flag(_);
Expand description
A value for a boolean named field that can only be a name (set) or omitted (unset).
Similar to an Option<SpannedValue<bool>>
but does not allow =
or
()
after the field name. Thus, it is only useful with named fields. Parsing this out of a
tuple struct or tuple variant will always result in a parse error.
It is not necessary to use #[deluxe(default)]
on a field
using this type. The field will automatically be created with a false
value if the name is
omitted.
Implementations§
source§impl Flag
impl Flag
sourcepub fn set_call_site() -> Self
pub fn set_call_site() -> Self
Creates a new true
flag value spanned to Span::call_site
.
Trait Implementations§
source§impl ParseMetaItem for Flag
impl ParseMetaItem for Flag
source§fn parse_meta_item(input: ParseStream<'_>, mode: ParseMode) -> Result<Self>
fn parse_meta_item(input: ParseStream<'_>, mode: ParseMode) -> Result<Self>
Parse the item from the tokens in
input
. Read moresource§fn parse_meta_item_inline<'s, S: Borrow<ParseBuffer<'s>>>(
inputs: &[S],
_mode: ParseMode
) -> Result<Self>
fn parse_meta_item_inline<'s, S: Borrow<ParseBuffer<'s>>>( inputs: &[S], _mode: ParseMode ) -> Result<Self>
Parse the item in an inline context. Read more
source§fn parse_meta_item_named(
input: ParseStream<'_>,
_name: &str,
span: Span
) -> Result<Self>
fn parse_meta_item_named( input: ParseStream<'_>, _name: &str, span: Span ) -> Result<Self>
Parses the item following a name. Read more
source§impl PartialEq<Flag> for Flag
impl PartialEq<Flag> for Flag
source§impl PartialEq<Flag> for bool
impl PartialEq<Flag> for bool
source§impl PartialEq<bool> for Flag
impl PartialEq<bool> for Flag
source§impl ToTokens for Flag
impl ToTokens for Flag
source§fn to_tokens(&self, tokens: &mut TokenStream)
fn to_tokens(&self, tokens: &mut TokenStream)
source§fn to_token_stream(&self) -> TokenStream
fn to_token_stream(&self) -> TokenStream
source§fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
fn into_token_stream(self) -> TokenStreamwhere Self: Sized,
impl Copy for Flag
impl Eq for Flag
Auto Trait Implementations§
impl RefUnwindSafe for Flag
impl !Send for Flag
impl !Sync for Flag
impl Unpin for Flag
impl UnwindSafe for Flag
Blanket Implementations§
source§impl<T> Spanned for Twhere
T: Spanned + ?Sized,
impl<T> Spanned for Twhere T: Spanned + ?Sized,
source§fn span(&self) -> Span
fn span(&self) -> Span
Returns a
Span
covering the complete contents of this syntax tree
node, or Span::call_site()
if this node is empty.