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 }
WhileLoop
while (cond) { body }
Repeat(Vec<RStmt>)
repeat { body }
IfElse
if (cond) { then } else if ... else { else }
Fields
Return(Option<RExpr>)
return(expr)
Next
next (continue)
Break
break
FunctionDef(RFunction)
Function definition: name <- function(formals) { body }
Library
library(pkg) or require(pkg)
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 })
SetMethod
S4 method definition: setMethod(generic, signature, function)
SetClass
S4 class definition
Trait Implementations§
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> 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