Skip to main content

StmtKind

Enum StmtKind 

Source
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

Fields

§condition: Expr
§body: Block
§elsifs: Vec<(Expr, Block)>
§else_block: Option<Block>
§

Unless

Fields

§condition: Expr
§body: Block
§else_block: Option<Block>
§

While

Fields

§condition: Expr
§body: Block
§continue_block: Option<Block>

while (...) { } continue { }

§

Until

Fields

§condition: Expr
§body: Block
§continue_block: Option<Block>
§

DoWhile

Fields

§body: Block
§condition: Expr
§

For

Fields

§condition: Option<Expr>
§step: Option<Expr>
§body: Block
§continue_block: Option<Block>
§

Foreach

Fields

§list: Expr
§body: Block
§continue_block: Option<Block>
§

SubDecl

Fields

§name: String
§body: Block
§prototype: Option<String>

Subroutine prototype text from sub foo ($$) { } (excluding parens). None when using structured SubSigParam signatures instead.

§

Package

Fields

§name: String
§

Use

Fields

§module: String
§imports: Vec<Expr>
§

UsePerlVersion

use 5.008; / use 5; — Perl version requirement (no-op at runtime in stryke).

Fields

§version: f64
§

UseOverload

use overload '""' => 'as_string', '+' => 'add'; — operator maps (method names in current package).

Fields

§pairs: Vec<(String, String)>
§

No

Fields

§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>)

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.

Fields

§target: Expr
§initializer: Option<Expr>
§

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.

Fields

§target: Box<Expr>
§

Continue(Block)

Standalone continue { BLOCK } (normally follows a loop; parsed for acceptance).

§

StructDecl

struct Name { field => Type, ... } — fixed-field records (Name->new, $x->field).

Fields

§

EnumDecl

enum Name { Variant1 => Type, Variant2, ... } — algebraic data types.

Fields

§

ClassDecl

class Name extends Parent impl Trait { fields; methods } — full OOP.

Fields

§

TraitDecl

trait Name { fn required; fn with_default { } } — interface/mixin.

Fields

§

EvalTimeout

eval_timeout SECS { ... } — run block on a worker thread; main waits up to SECS (portable timeout).

Fields

§timeout: Expr
§body: Block
§

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).

Fields

§try_block: Block
§catch_var: String
§catch_block: Block
§finally_block: Option<Block>
§

Given

given (EXPR) { when ... default ... } — topic in $_, when matches with regex / eq / smartmatch.

Fields

§topic: Expr
§body: Block
§

When

when (COND) { } — only valid inside given (handled by given dispatcher).

Fields

§cond: Expr
§body: Block
§

DefaultCase

default { } — only valid inside given.

Fields

§body: Block
§

Tie

tie %hash / tie @arr / tie $x — TIEHASH / TIEARRAY / TIESCALAR (FETCH/STORE).

Fields

§target: TieTarget
§class: Expr
§args: Vec<Expr>
§

FormatDecl

format NAME = picture/value lines … . — report templates for write.

Fields

§name: String
§lines: Vec<String>
§

AdviceDecl

before|after|around "<glob>" { ... } — register AOP advice on user subs. Pattern is a glob (*, ?) matched against the called sub’s bare name.

Fields

§pattern: String
§body: Block

Trait Implementations§

Source§

impl Clone for StmtKind

Source§

fn clone(&self) -> StmtKind

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for StmtKind

Source§

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

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

impl<'de> Deserialize<'de> for StmtKind

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more
Source§

impl Serialize for StmtKind

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations§

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> ArchivePointee for T

Source§

type ArchivedMetadata = ()

The archived version of the pointer metadata for this type.
Source§

fn pointer_metadata( _: &<T as ArchivePointee>::ArchivedMetadata, ) -> <T as Pointee>::Metadata

Converts some archived metadata to the pointer metadata for itself.
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<F, W, T, D> Deserialize<With<T, W>, D> for F
where W: DeserializeWith<F, T, D>, D: Fallible + ?Sized, F: ?Sized,

Source§

fn deserialize( &self, deserializer: &mut D, ) -> Result<With<T, W>, <D as Fallible>::Error>

Deserializes using the given deserializer
Source§

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<T> Finish for T

Source§

fn finish(self)

Does nothing but move self, equivalent to drop.
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts 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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts 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 more
Source§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

Source§

fn into_sample(self) -> T

Source§

impl<T> LayoutRaw for T

Source§

fn layout_raw(_: <T as Pointee>::Metadata) -> Result<Layout, LayoutError>

Gets the layout of the type.
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Pointee for T

Source§

type Metadata = ()

The type for metadata in pointers and references to Self.
Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<SS, SP> SupersetOf<SS> for SP
where SS: SubsetOf<SP>,

Source§

fn to_subset(&self) -> Option<SS>

The inverse inclusion map: attempts to construct self from the equivalent element of its superset. Read more
Source§

fn is_in_subset(&self) -> bool

Checks if self is actually part of its subset T (and can be converted to it).
Source§

fn to_subset_unchecked(&self) -> SS

Use with care! Same as self.to_subset but without any property checks. Always succeeds.
Source§

fn from_subset(element: &SS) -> SP

The inclusion map: converts self to the equivalent element of its superset.
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<U, T> ToOwnedObj<U> for T
where U: FromObjRef<T>,

Source§

fn to_owned_obj(&self, data: FontData<'_>) -> U

Convert this type into T, using the provided data to resolve any offsets.
Source§

impl<U, T> ToOwnedTable<U> for T
where U: FromTableRef<T>,

Source§

fn to_owned_table(&self) -> U

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.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V

Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,