Enum rune::ast::ItemStructBody[][src]

pub enum ItemStructBody {
    UnitBody,
    TupleBody(Parenthesized<Field, Comma>),
    StructBody(Braced<Field, Comma>),
}

AST for a struct body.

Variants

UnitBody

An empty struct declaration.

A tuple struct body.

StructBody(Braced<Field, Comma>)

A regular struct body.

Implementations

impl ItemStructBody[src]

pub fn fields(&self) -> impl Iterator<Item = &(Field, Option<Comma>)>[src]

Iterate over the fields of the body.

Trait Implementations

impl Clone for ItemStructBody[src]

impl Debug for ItemStructBody[src]

impl Eq for ItemStructBody[src]

impl OptionSpanned for ItemStructBody[src]

impl Parse for ItemStructBody[src]

Parse implementation for a struct body.

Examples

use rune::{testing, ast};

testing::roundtrip::<ast::ItemStructBody>("");

testing::roundtrip::<ast::ItemStructBody>("{ a, b, c }");
testing::roundtrip::<ast::ItemStructBody>("{ #[x] a, #[y] b, #[z] #[w] #[f32] c }");
testing::roundtrip::<ast::ItemStructBody>("{ a, #[attribute] b, c }");

testing::roundtrip::<ast::ItemStructBody>("( a, b, c )");
testing::roundtrip::<ast::ItemStructBody>("( #[x] a, b, c )");
testing::roundtrip::<ast::ItemStructBody>("( #[x] pub a, b, c )");
testing::roundtrip::<ast::ItemStructBody>("( a, b, c )");
testing::roundtrip::<ast::ItemStructBody>("()");

impl PartialEq<ItemStructBody> for ItemStructBody[src]

impl StructuralEq for ItemStructBody[src]

impl StructuralPartialEq for ItemStructBody[src]

impl ToTokens for ItemStructBody[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.