Struct darling_core::util::Flag [] [src]

pub struct Flag(_);

Marker type equivalent to Option<()> for use in attribute parsing.

Methods

impl Flag
[src]

[src]

Creates a new Flag which corresponds to the presence of a value.

Methods from Deref<Target = Option<()>>

1.0.0
[src]

Returns true if the option is a Some value.

Examples

let x: Option<u32> = Some(2);
assert_eq!(x.is_some(), true);

let x: Option<u32> = None;
assert_eq!(x.is_some(), false);

1.0.0
[src]

Returns true if the option is a None value.

Examples

let x: Option<u32> = Some(2);
assert_eq!(x.is_none(), false);

let x: Option<u32> = None;
assert_eq!(x.is_none(), true);

1.0.0
[src]

Converts from Option<T> to Option<&T>.

Examples

Convert an Option<String> into an Option<usize>, preserving the original. The map method takes the self argument by value, consuming the original, so this technique uses as_ref to first take an Option to a reference to the value inside the original.

let text: Option<String> = Some("Hello, world!".to_string());
// First, cast `Option<String>` to `Option<&String>` with `as_ref`,
// then consume *that* with `map`, leaving `text` on the stack.
let text_length: Option<usize> = text.as_ref().map(|s| s.len());
println!("still can print text: {:?}", text);

Important traits for Iter<'a, A>
1.0.0
[src]

Returns an iterator over the possibly contained value.

Examples

let x = Some(4);
assert_eq!(x.iter().next(), Some(&4));

let x: Option<u32> = None;
assert_eq!(x.iter().next(), None);

Trait Implementations

impl Debug for Flag
[src]

[src]

Formats the value using the given formatter. Read more

impl Clone for Flag
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl Copy for Flag
[src]

impl PartialEq for Flag
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

[src]

This method tests for !=.

impl Eq for Flag
[src]

impl Default for Flag
[src]

[src]

Returns the "default value" for a type. Read more

impl Deref for Flag
[src]

The resulting type after dereferencing.

[src]

Dereferences the value.

impl FromMeta for Flag
[src]

[src]

Create an instance from a syn::Meta by dispatching to the format-appropriate trait function. This generally should not be overridden by implementers. Read more

[src]

[src]

Create an instance from the presence of the word in the attribute with no additional options specified. Read more

[src]

Create an instance from a list of nested meta items.

[src]

Create an instance from a literal value of either foo = "bar" or foo("bar"). This dispatches to the appropriate method based on the type of literal encountered, and generally should not be overridden by implementers. Read more

[src]

Create an instance from a char literal in a value position.

[src]

Create an instance from a string literal in a value position.

[src]

Create an instance from a bool literal in a value position.

impl From<Flag> for bool
[src]

[src]

Performs the conversion.

impl From<bool> for Flag
[src]

[src]

Performs the conversion.

impl From<Option<()>> for Flag
[src]

[src]

Performs the conversion.

impl PartialEq<Option<()>> for Flag
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

1.0.0
[src]

This method tests for !=.

impl PartialEq<Flag> for Option<()>
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

1.0.0
[src]

This method tests for !=.

impl PartialEq<bool> for Flag
[src]

[src]

This method tests for self and other values to be equal, and is used by ==. Read more

1.0.0
[src]

This method tests for !=.

impl Not for Flag
[src]

The resulting type after applying the ! operator.

[src]

Performs the unary ! operation.

impl BitAnd for Flag
[src]

The resulting type after applying the & operator.

[src]

Performs the & operation.

impl BitOr for Flag
[src]

The resulting type after applying the | operator.

[src]

Performs the | operation.

Auto Trait Implementations

impl Send for Flag

impl Sync for Flag