Enum macrohelper::bodykind::structure::Structure
[−]
[src]
pub enum Structure { NormalStruct(Fields), TupleStruct(Fields), Unit, Discriminant(Lit), }
There are multiple types of structures in Rust.
Variants
NormalStruct(Fields)
The normal structure which has several fields
Example: pub struct AStruct{ a: u64, b: u64 }
TupleStruct(Fields)
A tuple struct which is just a named tuple
Example: pub struct AStruct( u64, u64);
Unit
A structure that contains no data
Example: pub struct ZeroSizedStruct;
Discriminant(Lit)
Literal Value
A structure cannot actually be this type. But Enum's as they can be declared with a constant value.
Methods
impl Structure
[src]
fn from_syn_variant(x: &SynVariant) -> Result<Structure, String>
Build a structure from syn
's representation
fn from_variantdata(x: &VariantData) -> Structure
Build a structure from syn
's representation
fn from_body(x: &Body) -> Result<Structure, String>
Build from syn
's Body representation
fn is_unit(&self) -> bool
fn is_norm(&self) -> bool
fn is_tuple(&self) -> bool
fn is_discriminant(&self) -> bool
fn get_fields<'a>(&'a self) -> Option<&'a Fields>
Get Fields
Returns Fields if this Struct is a Tuple or Normal
fn get_literal<'a>(&'a self) -> Option<&'a Lit>
Get Literal
Returns the literal value if this is a Discrimninat structure
fn from_literal(&self) -> Option<FromLiteral>
Get From Literal
Pre-Perform the conversion
Trait Implementations
impl Clone for Structure
[src]
fn clone(&self) -> Structure
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