Skip to main content

RStmt

Enum RStmt 

Source
pub enum RStmt {
Show 18 variants Assign(RAssignOp, String, RExpr), AssignLhs(RAssignOp, RExpr, RExpr), ForLoop { var: String, seq: RExpr, body: Vec<RStmt>, }, WhileLoop { cond: RExpr, body: Vec<RStmt>, }, Repeat(Vec<RStmt>), IfElse { cond: RExpr, then_body: Vec<RStmt>, else_if_branches: Vec<(RExpr, Vec<RStmt>)>, else_body: Option<Vec<RStmt>>, }, Return(Option<RExpr>), Next, Break, FunctionDef(RFunction), Library { pkg: String, use_require: bool, }, Source(String), Expr(RExpr), Comment(String), Stopifnot(Vec<RExpr>), TryCatch { body: Vec<RStmt>, handlers: Vec<(String, RFormal, Vec<RStmt>)>, finally: Option<Vec<RStmt>>, }, SetMethod { generic: String, signature: Vec<String>, fun: RFunction, }, SetClass { class: String, contains: Option<String>, slots: Vec<(String, RType)>, },
}
Expand description

R statement.

Variants§

§

Assign(RAssignOp, String, RExpr)

Assignment: x <- expr or x <<- expr or x = expr

§

AssignLhs(RAssignOp, RExpr, RExpr)

Complex left-hand side assignment: x$field <- expr

§

ForLoop

for (var in seq) { body }

Fields

§seq: RExpr
§body: Vec<RStmt>
§

WhileLoop

while (cond) { body }

Fields

§cond: RExpr
§body: Vec<RStmt>
§

Repeat(Vec<RStmt>)

repeat { body }

§

IfElse

if (cond) { then } else if ... else { else }

Fields

§cond: RExpr
§then_body: Vec<RStmt>
§else_if_branches: Vec<(RExpr, Vec<RStmt>)>
§else_body: Option<Vec<RStmt>>
§

Return(Option<RExpr>)

return(expr)

§

Next

next (continue)

§

Break

break

§

FunctionDef(RFunction)

Function definition: name <- function(formals) { body }

§

Library

library(pkg) or require(pkg)

Fields

§use_require: bool
§

Source(String)

source("file.R")

§

Expr(RExpr)

Expression statement

§

Comment(String)

Comment: # text

§

Stopifnot(Vec<RExpr>)

stopifnot(...) assertion

§

TryCatch

tryCatch({ body }, error = function(e) { handler })

Fields

§body: Vec<RStmt>
§handlers: Vec<(String, RFormal, Vec<RStmt>)>
§finally: Option<Vec<RStmt>>
§

SetMethod

S4 method definition: setMethod(generic, signature, function)

Fields

§generic: String
§signature: Vec<String>
§

SetClass

S4 class definition

Fields

§class: String
§contains: Option<String>
§slots: Vec<(String, RType)>

Trait Implementations§

Source§

impl Clone for RStmt

Source§

fn clone(&self) -> RStmt

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RStmt

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl PartialEq for RStmt

Source§

fn eq(&self, other: &RStmt) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralPartialEq for RStmt

Auto Trait Implementations§

§

impl Freeze for RStmt

§

impl RefUnwindSafe for RStmt

§

impl Send for RStmt

§

impl Sync for RStmt

§

impl Unpin for RStmt

§

impl UnsafeUnpin for RStmt

§

impl UnwindSafe for RStmt

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.