Struct rune::ast::ItemConst[][src]

pub struct ItemConst {
    pub id: Option<Id>,
    pub attributes: Vec<Attribute>,
    pub visibility: Visibility,
    pub const_token: Const,
    pub name: Ident,
    pub eq: Eq,
    pub expr: Expr,
}

A const declaration.

Examples

use rune::{testing, ast};

testing::roundtrip::<ast::ItemConst>("const value = #{}");

Fields

id: Option<Id>

Opaque identifier for the constant.

attributes: Vec<Attribute>

The inner attributes that are applied to the const declaration.

visibility: Visibility

The visibility of the const.

const_token: Const

The const keyword.

name: Ident

The name of the constant.

eq: Eq

The equals token.

expr: Expr

The optional body of the module declaration.

Implementations

impl ItemConst[src]

pub fn parse_with_meta(
    parser: &mut Parser<'_>,
    attributes: Vec<Attribute>,
    visibility: Visibility,
    const_token: Const
) -> Result<Self, ParseError>
[src]

Parse #ident and attach the given meta

impl ItemConst[src]

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

Get the descriptive span of this item, e.g. const ITEM instead of the span for the whole expression.

Trait Implementations

impl Clone for ItemConst[src]

impl Debug for ItemConst[src]

impl Eq for ItemConst[src]

impl Parse for ItemConst[src]

impl PartialEq<ItemConst> for ItemConst[src]

impl Spanned for ItemConst[src]

impl StructuralEq for ItemConst[src]

impl StructuralPartialEq for ItemConst[src]

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