Struct rune::ast::ItemMod [−][src]
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]
parser: &mut Parser<'_>,
attributes: Vec<Attribute>,
visibility: Visibility
) -> Result<Self, ParseError>
Parse #ident and attach the given meta
impl ItemMod
[src]
Trait Implementations
impl Clone for ItemMod
[src]
impl Debug for ItemMod
[src]
impl Eq for ItemMod
[src]
impl Parse for ItemMod
[src]
fn parse(p: &mut Parser<'_>) -> Result<Self, ParseError>
[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]
fn to_tokens(&self, context: &MacroContext, stream: &mut TokenStream)
[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]
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>,