[−][src]Struct rune::ast::ItemEnum
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]
parser: &mut Parser<'_>,
attributes: Vec<Attribute>,
visibility: Visibility
) -> Result<Self, ParseError>
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]
pub fn parse(p: &mut Parser<'_>) -> Result<Self, ParseError>
[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]
pub fn to_tokens(&self, context: &MacroContext, stream: &mut TokenStream)
[src]
Auto Trait Implementations
impl RefUnwindSafe for ItemEnum
[src]
impl Send for ItemEnum
[src]
impl Sync for ItemEnum
[src]
impl Unpin for ItemEnum
[src]
impl UnwindSafe for ItemEnum
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,