[−][src]Struct rune::ast::DeclFn
A function.
Fields
async_: Option<Async>
The optional async
keyword.
fn_: Fn
The fn
token.
name: Ident
The name of the function.
args: Parenthesized<FnArg, Comma>
The arguments of the function.
body: ExprBlock
The body of the function.
Implementations
impl DeclFn
[src]
pub fn item_span(&self) -> Span
[src]
Get the identifying span for this function.
pub fn span(&self) -> Span
[src]
Access the span for the function declaration.
pub fn is_instance(&self) -> bool
[src]
Test if function is an instance fn.
Trait Implementations
impl Clone for DeclFn
[src]
impl Debug for DeclFn
[src]
impl Parse for DeclFn
[src]
Parse implementation for a function.
Examples
use rune::{ParseAll, parse_all, ast, Resolve as _}; parse_all::<ast::DeclFn>("async fn hello() {}").unwrap(); assert!(parse_all::<ast::DeclFn>("fn async hello() {}").is_err()); let ParseAll { item, .. } = parse_all::<ast::DeclFn>("fn hello() {}").unwrap(); assert_eq!(item.args.items.len(), 0); let ParseAll { source, item } = parse_all::<ast::DeclFn>("fn hello(foo, bar) {}").unwrap(); assert_eq!(item.args.items.len(), 2); assert_eq!(item.name.resolve(source).unwrap(), "hello");
fn parse(parser: &mut Parser<'_>) -> Result<Self, ParseError>
[src]
Auto Trait Implementations
impl RefUnwindSafe for DeclFn
impl Send for DeclFn
impl Sync for DeclFn
impl Unpin for DeclFn
impl UnwindSafe for DeclFn
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,
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.
fn to_owned(&self) -> T
[src]
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.
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>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,