Enum macrohelper::meta::HashTag
[−]
[src]
pub enum HashTag { Word(String), List(String, Vec<Box<HashTag>>), NameValue(String, Lit), Literal(Lit), }
For arguments within #[derive ...]
tag
Variants
Word(String)
The name of a MetaItem.
#[test]
will return MetaItem::Word("Test")
List(String, Vec<Box<HashTag>>)
A list of values
#[derive(Copy,Clone)]
will return
MetaItem::List("derive",vec![Box::new(MetaItem::Word("Copy")),Box::new(MetaItem::Word("Clone"))])
NameValue(String, Lit)
An assigned value
#[feature = "thing"]
will return MetaItem::NameValue("feature", Literal::Str)
Literal(Lit)
A literal
This isn't a first level item. It can be encountered within
MetaItem::List(_, vec![])
part. It is included to prevent
defining a whole extra type like syn
does.
Methods
impl HashTag
[src]
fn new(x: &MetaItem) -> HashTag
Build a hashtag from a metatime
fn complete(x: &[Attribute]) -> Vec<HashTag>
Borrow Attribute value and parse
fn is_word(&self) -> bool
fn is_list(&self) -> bool
fn is_name_value(&self) -> bool
fn is_literal(&self) -> bool
fn get_name<'a>(&'a self) -> Option<&'a str>
Returns the name of the #[...]
value
The literal
exists so this can technically fail
to return some
fn get_name_value<'a>(&'a self) -> Option<&'a Lit>
Get Assignment
When #[hashtag = value]
is used
this function will return the value
half
fn get_arg_list<'a>(&'a self) -> Option<&'a [Box<HashTag>]>
Get List
Fetches the internal list if a hashtag
like #[derive(Clone,Copy)]
Which will
return an array of the [Clone,Copy]
fn get_literal<'a>(&'a self) -> Option<&'a Lit>
Get Literal
If the hashtag has an associated literal be it
NameValue
or Literal
this will return that
value
fn from_literal(&self) -> Option<FromLiteral>
Get From Literal
Pre-Perform the conversion
Trait Implementations
impl Clone for HashTag
[src]
fn clone(&self) -> HashTag
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more