Struct darling::util::Flag
[−]
[src]
pub struct Flag(_);
Marker type equivalent to Option<()> for use in attribute parsing.
Methods
impl Flag[src]
Methods from Deref<Target = Option<()>>
pub fn is_some(&self) -> bool1.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);
pub fn is_none(&self) -> bool1.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);
pub fn as_ref(&self) -> Option<&T>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 num_as_str: Option<String> = Some("10".to_string()); // First, cast `Option<String>` to `Option<&String>` with `as_ref`, // then consume *that* with `map`, leaving `num_as_str` on the stack. let num_as_int: Option<usize> = num_as_str.as_ref().map(|n| n.len()); println!("still can print num_as_str: {:?}", num_as_str);
ⓘImportant traits for Iter<'a, A>pub fn iter(&self) -> Iter<T>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]
fn fmt(&self, __arg_0: &mut Formatter) -> Result<(), Error>[src]
Formats the value using the given formatter. Read more
impl Eq for Flag[src]
impl Default for Flag[src]
impl From<bool> for Flag[src]
impl From<Option<()>> for Flag[src]
impl From<Flag> for bool[src]
impl Not for Flag[src]
type Output = Flag
The resulting type after applying the ! operator.
fn not(self) -> Flag[src]
Performs the unary ! operation.
impl BitAnd<Flag> for Flag[src]
type Output = Flag
The resulting type after applying the & operator.
fn bitand(self, rhs: Flag) -> Flag[src]
Performs the & operation.
impl Clone for Flag[src]
fn clone(&self) -> Flag[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)1.0.0[src]
Performs copy-assignment from source. Read more
impl Copy for Flag[src]
impl BitOr<Flag> for Flag[src]
type Output = Flag
The resulting type after applying the | operator.
fn bitor(self, rhs: Flag) -> Flag[src]
Performs the | operation.
impl PartialEq<Flag> for Flag[src]
fn eq(&self, __arg_0: &Flag) -> bool[src]
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, __arg_0: &Flag) -> bool[src]
This method tests for !=.
impl PartialEq<bool> for Flag[src]
fn eq(&self, rhs: &bool) -> bool[src]
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &Rhs) -> bool1.0.0[src]
This method tests for !=.
impl PartialEq<Option<()>> for Flag[src]
fn eq(&self, rhs: &Option<()>) -> bool[src]
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &Rhs) -> bool1.0.0[src]
This method tests for !=.
impl PartialEq<Flag> for Option<()>[src]
fn eq(&self, rhs: &Flag) -> bool[src]
This method tests for self and other values to be equal, and is used by ==. Read more
fn ne(&self, other: &Rhs) -> bool1.0.0[src]
This method tests for !=.
impl FromMetaItem for Flag[src]
fn from_meta_item(mi: &Meta) -> Result<Flag, Error>[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
fn from_nested_meta_item(item: &NestedMeta) -> Result<Self, Error>[src]
fn from_word() -> Result<Self, Error>[src]
Create an instance from the presence of the word in the attribute with no additional options specified. Read more
fn from_list(items: &[NestedMeta]) -> Result<Self, Error>[src]
Create an instance from a list of nested meta items.
fn from_value(value: &Lit) -> Result<Self, Error>[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
fn from_char(value: char) -> Result<Self, Error>[src]
Create an instance from a char literal in a value position.
fn from_string(value: &str) -> Result<Self, Error>[src]
Create an instance from a string literal in a value position.
fn from_bool(value: bool) -> Result<Self, Error>[src]
Create an instance from a bool literal in a value position.