[−][src]Struct rune::ast::ExprBlock
A block of expressions.
Fields
async_: Option<Async>
If the block is async or not.
open: OpenBrace
The close brace.
exprs: Vec<(Expr, Option<SemiColon>)>
Expressions in the block.
trailing_expr: Option<Box<Expr>>
Test if the expression is trailing.
close: CloseBrace
The close brace.
Implementations
impl ExprBlock
[src]
pub fn span(&self) -> Span
[src]
Get the span of the block.
pub fn produces_nothing(&self) -> bool
[src]
Test if the block is empty.
pub fn is_const(&self) -> bool
[src]
ExprBlock is constant if a trailing expression exists and is all literal.
Trait Implementations
impl Clone for ExprBlock
[src]
impl Debug for ExprBlock
[src]
impl Parse for ExprBlock
[src]
Parse implementation for a block.
Examples
use rune::{parse_all, ast}; let block = parse_all::<ast::ExprBlock>("async {}")?.item; assert_eq!(block.exprs.len(), 0); assert!(block.trailing_expr.is_none()); assert!(block.async_.is_some()); let block = parse_all::<ast::ExprBlock>("{}")?.item; assert_eq!(block.exprs.len(), 0); assert!(block.trailing_expr.is_none()); let block = parse_all::<ast::ExprBlock>("{ foo }")?.item; assert_eq!(block.exprs.len(), 0); assert!(block.trailing_expr.is_some()); let block = parse_all::<ast::ExprBlock>("{ foo; }")?.item; assert_eq!(block.exprs.len(), 1); assert!(block.trailing_expr.is_none()); let block = parse_all::<ast::ExprBlock>(r#" { let foo = 42; let bar = "string"; baz } "#)?.item; assert!(block.async_.is_none()); assert_eq!(block.exprs.len(), 2); assert!(block.trailing_expr.is_some());
fn parse(parser: &mut Parser<'_>) -> Result<Self, ParseError>
[src]
Auto Trait Implementations
impl RefUnwindSafe for ExprBlock
impl Send for ExprBlock
impl Sync for ExprBlock
impl Unpin for ExprBlock
impl UnwindSafe for ExprBlock
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>,