Struct rune::ast::ItemEnum[][src]

pub struct ItemEnum {
    pub attributes: Vec<Attribute>,
    pub visibility: Visibility,
    pub enum_token: Enum,
    pub name: Ident,
    pub variants: Braced<ItemVariant, Comma>,
}

An enum item.

Examples

use rune::{testing, ast};

testing::roundtrip::<ast::ItemEnum>("enum Foo { Bar(a), Baz(b), Empty() }");
testing::roundtrip::<ast::ItemEnum>("enum Foo { Bar(a), Baz(b), #[default_value = \"zombie\"] Empty() }");
testing::roundtrip::<ast::ItemEnum>("#[repr(Rune)] enum Foo { Bar(a), Baz(b), #[default_value = \"zombie\"] Empty() }");
testing::roundtrip::<ast::ItemEnum>("pub enum Color { Blue, Red, Green }");

Fields

attributes: Vec<Attribute>

The attributes for the enum block

visibility: Visibility

The visibility of the enum item

enum_token: Enum

The enum token.

name: Ident

The name of the enum.

variants: Braced<ItemVariant, Comma>

Variants in the enum.

Implementations

impl ItemEnum[src]

pub fn parse_with_meta(
    parser: &mut Parser<'_>,
    attributes: Vec<Attribute>,
    visibility: Visibility
) -> Result<Self, ParseError>
[src]

Parse #ident and attach the given meta

Trait Implementations

impl Clone for ItemEnum[src]

impl Debug for ItemEnum[src]

impl Eq for ItemEnum[src]

impl Parse for ItemEnum[src]

impl PartialEq<ItemEnum> for ItemEnum[src]

impl Spanned for ItemEnum[src]

impl StructuralEq for ItemEnum[src]

impl StructuralPartialEq for ItemEnum[src]

impl ToTokens for ItemEnum[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.