pub enum StmtKind {
Show 47 variants
Expression(Expr),
If {
condition: Expr,
body: Block,
elsifs: Vec<(Expr, Block)>,
else_block: Option<Block>,
},
Unless {
condition: Expr,
body: Block,
else_block: Option<Block>,
},
While {
condition: Expr,
body: Block,
label: Option<String>,
continue_block: Option<Block>,
},
Until {
condition: Expr,
body: Block,
label: Option<String>,
continue_block: Option<Block>,
},
DoWhile {
body: Block,
condition: Expr,
},
For {
init: Option<Box<Statement>>,
condition: Option<Expr>,
step: Option<Expr>,
body: Block,
label: Option<String>,
continue_block: Option<Block>,
},
Foreach {
var: String,
list: Expr,
body: Block,
label: Option<String>,
continue_block: Option<Block>,
},
SubDecl {
name: String,
params: Vec<SubSigParam>,
body: Block,
prototype: Option<String>,
},
Package {
name: String,
},
Use {
module: String,
imports: Vec<Expr>,
},
UsePerlVersion {
version: f64,
},
UseOverload {
pairs: Vec<(String, String)>,
},
No {
module: String,
imports: Vec<Expr>,
},
Return(Option<Expr>),
Last(Option<String>),
Next(Option<String>),
Redo(Option<String>),
My(Vec<VarDecl>),
Our(Vec<VarDecl>),
Local(Vec<VarDecl>),
State(Vec<VarDecl>),
LocalExpr {
target: Expr,
initializer: Option<Expr>,
},
MySync(Vec<VarDecl>),
OurSync(Vec<VarDecl>),
Block(Block),
StmtGroup(Block),
Begin(Block),
End(Block),
UnitCheck(Block),
Check(Block),
Init(Block),
Empty,
Goto {
target: Box<Expr>,
},
Continue(Block),
StructDecl {
def: StructDef,
},
EnumDecl {
def: EnumDef,
},
ClassDecl {
def: ClassDef,
},
TraitDecl {
def: TraitDef,
},
EvalTimeout {
timeout: Expr,
body: Block,
},
TryCatch {
try_block: Block,
catch_var: String,
catch_block: Block,
finally_block: Option<Block>,
},
Given {
topic: Expr,
body: Block,
},
When {
cond: Expr,
body: Block,
},
DefaultCase {
body: Block,
},
Tie {
target: TieTarget,
class: Expr,
args: Vec<Expr>,
},
FormatDecl {
name: String,
lines: Vec<String>,
},
AdviceDecl {
kind: AdviceKind,
pattern: String,
body: Block,
},
}Variants§
Expression(Expr)
If
Unless
While
Fields
Until
DoWhile
For
Fields
Foreach
SubDecl
Fields
params: Vec<SubSigParam>prototype: Option<String>Subroutine prototype text from sub foo ($$) { } (excluding parens).
None when using structured SubSigParam signatures instead.
Package
Use
UsePerlVersion
use 5.008; / use 5; — Perl version requirement (no-op at runtime in stryke).
UseOverload
use overload '""' => 'as_string', '+' => 'add'; — operator maps (method names in current package).
No
Return(Option<Expr>)
Last(Option<String>)
Next(Option<String>)
Redo(Option<String>)
My(Vec<VarDecl>)
Our(Vec<VarDecl>)
Local(Vec<VarDecl>)
State(Vec<VarDecl>)
state $x = 0 — persistent lexical variable (initialized once per sub)
LocalExpr
local $h{k} / local $SIG{__WARN__} — lvalues that are not plain my-style names.
MySync(Vec<VarDecl>)
mysync $x = 0 — thread-safe atomic variable for parallel blocks
OurSync(Vec<VarDecl>)
oursync $x = 0 — package-global thread-safe atomic variable. Same as
mysync but the binding lives in the package stash (e.g. main::x)
so it is visible across packages and parallel workers share one cell.
Block(Block)
Bare block (for scoping or do {})
StmtGroup(Block)
Statements run in order without an extra scope frame (parser desugar).
Begin(Block)
BEGIN { ... }
End(Block)
END { ... }
UnitCheck(Block)
UNITCHECK { ... } — end of compilation unit (reverse order before CHECK).
Check(Block)
CHECK { ... } — end of compile phase (reverse order).
Init(Block)
INIT { ... } — before runtime main (forward order).
Empty
Empty statement (bare semicolon)
Goto
goto EXPR — expression evaluates to a label name in the same block.
Continue(Block)
Standalone continue { BLOCK } (normally follows a loop; parsed for acceptance).
StructDecl
struct Name { field => Type, ... } — fixed-field records (Name->new, $x->field).
EnumDecl
enum Name { Variant1 => Type, Variant2, ... } — algebraic data types.
ClassDecl
class Name extends Parent impl Trait { fields; methods } — full OOP.
TraitDecl
trait Name { fn required; fn with_default { } } — interface/mixin.
EvalTimeout
eval_timeout SECS { ... } — run block on a worker thread; main waits up to SECS (portable timeout).
TryCatch
try { } catch ($err) { } [ finally { } ] — catch runtime/die errors (not last/next/return flow).
finally runs after a successful try or after catch completes (including if catch rethrows).
Given
given (EXPR) { when ... default ... } — topic in $_, when matches with regex / eq / smartmatch.
When
when (COND) { } — only valid inside given (handled by given dispatcher).
DefaultCase
default { } — only valid inside given.
Tie
tie %hash / tie @arr / tie $x — TIEHASH / TIEARRAY / TIESCALAR (FETCH/STORE).
FormatDecl
format NAME = picture/value lines … . — report templates for write.
AdviceDecl
before|after|around "<glob>" { ... } — register AOP advice on user subs.
Pattern is a glob (*, ?) matched against the called sub’s bare name.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for StmtKind
impl<'de> Deserialize<'de> for StmtKind
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Auto Trait Implementations§
impl Freeze for StmtKind
impl RefUnwindSafe for StmtKind
impl Send for StmtKind
impl Sync for StmtKind
impl Unpin for StmtKind
impl UnsafeUnpin for StmtKind
impl UnwindSafe for StmtKind
Blanket Implementations§
Source§impl<T> ArchivePointee for T
impl<T> ArchivePointee for T
Source§type ArchivedMetadata = ()
type ArchivedMetadata = ()
Source§fn pointer_metadata(
_: &<T as ArchivePointee>::ArchivedMetadata,
) -> <T as Pointee>::Metadata
fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<F, W, T, D> Deserialize<With<T, W>, D> for F
impl<F, W, T, D> Deserialize<With<T, W>, D> for F
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
impl<F, T> IntoSample<T> for Fwhere
T: FromSample<F>,
fn into_sample(self) -> T
Source§impl<T> LayoutRaw for T
impl<T> LayoutRaw for T
Source§fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>
Source§impl<T> Pointable for T
impl<T> Pointable for T
Source§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
Source§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
self from the equivalent element of its
superset. Read moreSource§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
self is actually part of its subset T (and can be converted to it).Source§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
self.to_subset but without any property checks. Always succeeds.Source§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
self to the equivalent element of its superset.Source§impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
impl<U, T> ToOwnedObj<U> for Twhere
U: FromObjRef<T>,
Source§fn to_owned_obj(&self, data: FontData<'_>) -> U
fn to_owned_obj(&self, data: FontData<'_>) -> U
T, using the provided data to resolve any offsets.