pub struct Statement {
pub value: StatementEnum,
pub span: Span,
}Expand description
The statement type.
Fields§
§value: StatementEnumThe type of statement.
span: SpanThe location of the statement.
Implementations§
source§impl Statement
impl Statement
sourcepub fn expect<T>(&self) -> Result<T>
pub fn expect<T>(&self) -> Result<T>
Downcast this statement to its inner type. Returns an ErrorType::UnexpectedStatement when T is not the type of the inner statement.
§Examples
use vyder_core::prelude::*;
let statement: Statement = Statement { value: statements::Break.into(), span: Span::new_with_end((1, 1, 0), (1, 6, 5), "example") };
assert!(statement.expect::<statements::Return>().is_err());
let _: statements::Break = statement.expect::<statements::Break>().unwrap();Trait Implementations§
impl StructuralPartialEq for Statement
Auto Trait Implementations§
impl Freeze for Statement
impl RefUnwindSafe for Statement
impl Send for Statement
impl Sync for Statement
impl Unpin for Statement
impl UnwindSafe for Statement
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit)