Struct rune::ast::ItemMod[][src]

pub struct ItemMod {
    pub id: Option<Id>,
    pub attributes: Vec<Attribute>,
    pub visibility: Visibility,
    pub mod_token: Mod,
    pub name: Ident,
    pub body: ItemModBody,
}

A module item.

Examples

use rune::{testing, ast};

testing::roundtrip::<ast::ItemMod>("mod ruins {}");

let item = testing::roundtrip::<ast::ItemMod>("#[cfg(test)] mod tests {}");
assert_eq!(item.attributes.len(), 1);

let item = testing::roundtrip::<ast::ItemMod>("mod whiskey_bravo { #![allow(dead_code)] fn x() {} }");
assert_eq!(item.attributes.len(), 0);
assert!(matches!(item.body, ast::ItemModBody::InlineBody(..)));

Fields

id: Option<Id>

The id of the module item.

attributes: Vec<Attribute>

The inner attributes are applied to the module #[cfg(test)] mod tests { }

visibility: Visibility

The visibility of the mod item

mod_token: Mod

The mod keyword.

name: Ident

The name of the mod.

body: ItemModBody

The optional body of the module declaration.

Implementations

impl ItemMod[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 ItemMod[src]

pub fn name_span(&self) -> Span[src]

Get the span of the mod name.

Trait Implementations

impl Clone for ItemMod[src]

impl Debug for ItemMod[src]

impl Eq for ItemMod[src]

impl Parse for ItemMod[src]

impl PartialEq<ItemMod> for ItemMod[src]

impl Spanned for ItemMod[src]

impl StructuralEq for ItemMod[src]

impl StructuralPartialEq for ItemMod[src]

impl ToTokens for ItemMod[src]

Auto Trait Implementations

impl RefUnwindSafe for ItemMod

impl Send for ItemMod

impl Sync for ItemMod

impl Unpin for ItemMod

impl UnwindSafe for ItemMod

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.