Struct rune::ast::ItemStruct[][src]

pub struct ItemStruct {
    pub id: Option<Id>,
    pub attributes: Vec<Attribute>,
    pub visibility: Visibility,
    pub struct_token: Struct,
    pub ident: Ident,
    pub body: ItemStructBody,
}

A struct item.

Examples

use rune::{testing, ast};

testing::roundtrip::<ast::ItemStruct>("struct Foo");
testing::roundtrip::<ast::ItemStruct>("struct Foo ( a, b, c )");
testing::roundtrip::<ast::ItemStruct>("struct Foo { a, b, c }");
testing::roundtrip::<ast::ItemStruct>("struct Foo { #[default_value = 1] a, b, c }");
testing::roundtrip::<ast::ItemStruct>("#[alpha] struct Foo ( #[default_value = \"x\" ] a, b, c )");

Fields

id: Option<Id>

Opaque identifier of the struct.

attributes: Vec<Attribute>

The attributes for the struct

visibility: Visibility

The visibility of the struct item

struct_token: Struct

The struct keyword.

ident: Ident

The identifier of the struct declaration.

body: ItemStructBody

The body of the struct.

Implementations

impl ItemStruct[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

impl ItemStruct[src]

pub fn needs_semi_colon(&self) -> bool[src]

If the struct declaration needs to be terminated with a semicolon.

Trait Implementations

impl Clone for ItemStruct[src]

impl Debug for ItemStruct[src]

impl Eq for ItemStruct[src]

impl Parse for ItemStruct[src]

impl PartialEq<ItemStruct> for ItemStruct[src]

impl Spanned for ItemStruct[src]

impl StructuralEq for ItemStruct[src]

impl StructuralPartialEq for ItemStruct[src]

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