Skip to main content

Stmt

Enum Stmt 

Source
pub enum Stmt {
Show 25 variants FunctionDef(StmtFunctionDef), ClassDef(StmtClassDef), Return(StmtReturn), Delete(StmtDelete), TypeAlias(StmtTypeAlias), Assign(StmtAssign), AugAssign(StmtAugAssign), AnnAssign(StmtAnnAssign), For(StmtFor), While(StmtWhile), If(StmtIf), With(StmtWith), Match(StmtMatch), Raise(StmtRaise), Try(StmtTry), Assert(StmtAssert), Import(StmtImport), ImportFrom(StmtImportFrom), Global(StmtGlobal), Nonlocal(StmtNonlocal), Expr(StmtExpr), Pass(StmtPass), Break(StmtBreak), Continue(StmtContinue), IpyEscapeCommand(StmtIpyEscapeCommand),
}
Expand description

See also stmt

Variants§

§

FunctionDef(StmtFunctionDef)

§

ClassDef(StmtClassDef)

§

Return(StmtReturn)

§

Delete(StmtDelete)

§

TypeAlias(StmtTypeAlias)

§

Assign(StmtAssign)

§

AugAssign(StmtAugAssign)

§

AnnAssign(StmtAnnAssign)

§

For(StmtFor)

§

While(StmtWhile)

§

If(StmtIf)

§

With(StmtWith)

§

Match(StmtMatch)

§

Raise(StmtRaise)

§

Try(StmtTry)

§

Assert(StmtAssert)

§

Import(StmtImport)

§

ImportFrom(StmtImportFrom)

§

Global(StmtGlobal)

§

Nonlocal(StmtNonlocal)

§

Expr(StmtExpr)

§

Pass(StmtPass)

§

Break(StmtBreak)

§

Continue(StmtContinue)

§

IpyEscapeCommand(StmtIpyEscapeCommand)

Implementations§

Source§

impl Stmt

Source

pub const fn is_function_def_stmt(&self) -> bool

Source

pub fn function_def_stmt(self) -> Option<StmtFunctionDef>

Source

pub fn expect_function_def_stmt(self) -> StmtFunctionDef

Source

pub fn as_function_def_stmt_mut(&mut self) -> Option<&mut StmtFunctionDef>

Source

pub fn as_function_def_stmt(&self) -> Option<&StmtFunctionDef>

Source

pub const fn is_class_def_stmt(&self) -> bool

Source

pub fn class_def_stmt(self) -> Option<StmtClassDef>

Source

pub fn expect_class_def_stmt(self) -> StmtClassDef

Source

pub fn as_class_def_stmt_mut(&mut self) -> Option<&mut StmtClassDef>

Source

pub fn as_class_def_stmt(&self) -> Option<&StmtClassDef>

Source

pub const fn is_return_stmt(&self) -> bool

Source

pub fn return_stmt(self) -> Option<StmtReturn>

Source

pub fn expect_return_stmt(self) -> StmtReturn

Source

pub fn as_return_stmt_mut(&mut self) -> Option<&mut StmtReturn>

Source

pub fn as_return_stmt(&self) -> Option<&StmtReturn>

Source

pub const fn is_delete_stmt(&self) -> bool

Source

pub fn delete_stmt(self) -> Option<StmtDelete>

Source

pub fn expect_delete_stmt(self) -> StmtDelete

Source

pub fn as_delete_stmt_mut(&mut self) -> Option<&mut StmtDelete>

Source

pub fn as_delete_stmt(&self) -> Option<&StmtDelete>

Source

pub const fn is_type_alias_stmt(&self) -> bool

Source

pub fn type_alias_stmt(self) -> Option<StmtTypeAlias>

Source

pub fn expect_type_alias_stmt(self) -> StmtTypeAlias

Source

pub fn as_type_alias_stmt_mut(&mut self) -> Option<&mut StmtTypeAlias>

Source

pub fn as_type_alias_stmt(&self) -> Option<&StmtTypeAlias>

Source

pub const fn is_assign_stmt(&self) -> bool

Source

pub fn assign_stmt(self) -> Option<StmtAssign>

Source

pub fn expect_assign_stmt(self) -> StmtAssign

Source

pub fn as_assign_stmt_mut(&mut self) -> Option<&mut StmtAssign>

Source

pub fn as_assign_stmt(&self) -> Option<&StmtAssign>

Source

pub const fn is_aug_assign_stmt(&self) -> bool

Source

pub fn aug_assign_stmt(self) -> Option<StmtAugAssign>

Source

pub fn expect_aug_assign_stmt(self) -> StmtAugAssign

Source

pub fn as_aug_assign_stmt_mut(&mut self) -> Option<&mut StmtAugAssign>

Source

pub fn as_aug_assign_stmt(&self) -> Option<&StmtAugAssign>

Source

pub const fn is_ann_assign_stmt(&self) -> bool

Source

pub fn ann_assign_stmt(self) -> Option<StmtAnnAssign>

Source

pub fn expect_ann_assign_stmt(self) -> StmtAnnAssign

Source

pub fn as_ann_assign_stmt_mut(&mut self) -> Option<&mut StmtAnnAssign>

Source

pub fn as_ann_assign_stmt(&self) -> Option<&StmtAnnAssign>

Source

pub const fn is_for_stmt(&self) -> bool

Source

pub fn for_stmt(self) -> Option<StmtFor>

Source

pub fn expect_for_stmt(self) -> StmtFor

Source

pub fn as_for_stmt_mut(&mut self) -> Option<&mut StmtFor>

Source

pub fn as_for_stmt(&self) -> Option<&StmtFor>

Source

pub const fn is_while_stmt(&self) -> bool

Source

pub fn while_stmt(self) -> Option<StmtWhile>

Source

pub fn expect_while_stmt(self) -> StmtWhile

Source

pub fn as_while_stmt_mut(&mut self) -> Option<&mut StmtWhile>

Source

pub fn as_while_stmt(&self) -> Option<&StmtWhile>

Source

pub const fn is_if_stmt(&self) -> bool

Source

pub fn if_stmt(self) -> Option<StmtIf>

Source

pub fn expect_if_stmt(self) -> StmtIf

Source

pub fn as_if_stmt_mut(&mut self) -> Option<&mut StmtIf>

Source

pub fn as_if_stmt(&self) -> Option<&StmtIf>

Source

pub const fn is_with_stmt(&self) -> bool

Source

pub fn with_stmt(self) -> Option<StmtWith>

Source

pub fn expect_with_stmt(self) -> StmtWith

Source

pub fn as_with_stmt_mut(&mut self) -> Option<&mut StmtWith>

Source

pub fn as_with_stmt(&self) -> Option<&StmtWith>

Source

pub const fn is_match_stmt(&self) -> bool

Source

pub fn match_stmt(self) -> Option<StmtMatch>

Source

pub fn expect_match_stmt(self) -> StmtMatch

Source

pub fn as_match_stmt_mut(&mut self) -> Option<&mut StmtMatch>

Source

pub fn as_match_stmt(&self) -> Option<&StmtMatch>

Source

pub const fn is_raise_stmt(&self) -> bool

Source

pub fn raise_stmt(self) -> Option<StmtRaise>

Source

pub fn expect_raise_stmt(self) -> StmtRaise

Source

pub fn as_raise_stmt_mut(&mut self) -> Option<&mut StmtRaise>

Source

pub fn as_raise_stmt(&self) -> Option<&StmtRaise>

Source

pub const fn is_try_stmt(&self) -> bool

Source

pub fn try_stmt(self) -> Option<StmtTry>

Source

pub fn expect_try_stmt(self) -> StmtTry

Source

pub fn as_try_stmt_mut(&mut self) -> Option<&mut StmtTry>

Source

pub fn as_try_stmt(&self) -> Option<&StmtTry>

Source

pub const fn is_assert_stmt(&self) -> bool

Source

pub fn assert_stmt(self) -> Option<StmtAssert>

Source

pub fn expect_assert_stmt(self) -> StmtAssert

Source

pub fn as_assert_stmt_mut(&mut self) -> Option<&mut StmtAssert>

Source

pub fn as_assert_stmt(&self) -> Option<&StmtAssert>

Source

pub const fn is_import_stmt(&self) -> bool

Source

pub fn import_stmt(self) -> Option<StmtImport>

Source

pub fn expect_import_stmt(self) -> StmtImport

Source

pub fn as_import_stmt_mut(&mut self) -> Option<&mut StmtImport>

Source

pub fn as_import_stmt(&self) -> Option<&StmtImport>

Source

pub const fn is_import_from_stmt(&self) -> bool

Source

pub fn import_from_stmt(self) -> Option<StmtImportFrom>

Source

pub fn expect_import_from_stmt(self) -> StmtImportFrom

Source

pub fn as_import_from_stmt_mut(&mut self) -> Option<&mut StmtImportFrom>

Source

pub fn as_import_from_stmt(&self) -> Option<&StmtImportFrom>

Source

pub const fn is_global_stmt(&self) -> bool

Source

pub fn global_stmt(self) -> Option<StmtGlobal>

Source

pub fn expect_global_stmt(self) -> StmtGlobal

Source

pub fn as_global_stmt_mut(&mut self) -> Option<&mut StmtGlobal>

Source

pub fn as_global_stmt(&self) -> Option<&StmtGlobal>

Source

pub const fn is_nonlocal_stmt(&self) -> bool

Source

pub fn nonlocal_stmt(self) -> Option<StmtNonlocal>

Source

pub fn expect_nonlocal_stmt(self) -> StmtNonlocal

Source

pub fn as_nonlocal_stmt_mut(&mut self) -> Option<&mut StmtNonlocal>

Source

pub fn as_nonlocal_stmt(&self) -> Option<&StmtNonlocal>

Source

pub const fn is_expr_stmt(&self) -> bool

Source

pub fn expr_stmt(self) -> Option<StmtExpr>

Source

pub fn expect_expr_stmt(self) -> StmtExpr

Source

pub fn as_expr_stmt_mut(&mut self) -> Option<&mut StmtExpr>

Source

pub fn as_expr_stmt(&self) -> Option<&StmtExpr>

Source

pub const fn is_pass_stmt(&self) -> bool

Source

pub fn pass_stmt(self) -> Option<StmtPass>

Source

pub fn expect_pass_stmt(self) -> StmtPass

Source

pub fn as_pass_stmt_mut(&mut self) -> Option<&mut StmtPass>

Source

pub fn as_pass_stmt(&self) -> Option<&StmtPass>

Source

pub const fn is_break_stmt(&self) -> bool

Source

pub fn break_stmt(self) -> Option<StmtBreak>

Source

pub fn expect_break_stmt(self) -> StmtBreak

Source

pub fn as_break_stmt_mut(&mut self) -> Option<&mut StmtBreak>

Source

pub fn as_break_stmt(&self) -> Option<&StmtBreak>

Source

pub const fn is_continue_stmt(&self) -> bool

Source

pub fn continue_stmt(self) -> Option<StmtContinue>

Source

pub fn expect_continue_stmt(self) -> StmtContinue

Source

pub fn as_continue_stmt_mut(&mut self) -> Option<&mut StmtContinue>

Source

pub fn as_continue_stmt(&self) -> Option<&StmtContinue>

Source

pub const fn is_ipy_escape_command_stmt(&self) -> bool

Source

pub fn ipy_escape_command_stmt(self) -> Option<StmtIpyEscapeCommand>

Source

pub fn expect_ipy_escape_command_stmt(self) -> StmtIpyEscapeCommand

Source

pub fn as_ipy_escape_command_stmt_mut( &mut self, ) -> Option<&mut StmtIpyEscapeCommand>

Source

pub fn as_ipy_escape_command_stmt(&self) -> Option<&StmtIpyEscapeCommand>

Trait Implementations§

Source§

impl Clone for Stmt

Source§

fn clone(&self) -> Stmt

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 Stmt

Source§

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

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

impl<'a> From<&'a Stmt> for AnyNodeRef<'a>

Source§

fn from(node: &'a Stmt) -> AnyNodeRef<'a>

Converts to this type from the input type.
Source§

impl<'a> From<&'a Stmt> for AnyRootNodeRef<'a>

Source§

fn from(node: &'a Stmt) -> AnyRootNodeRef<'a>

Converts to this type from the input type.
Source§

impl<'a> From<&'a Stmt> for ComparableStmt<'a>

Source§

fn from(stmt: &'a Stmt) -> Self

Converts to this type from the input type.
Source§

impl<'a> From<&'a Stmt> for StmtRef<'a>

Source§

fn from(node: &'a Stmt) -> Self

Converts to this type from the input type.
Source§

impl From<StmtAnnAssign> for Stmt

Source§

fn from(node: StmtAnnAssign) -> Self

Converts to this type from the input type.
Source§

impl From<StmtAssert> for Stmt

Source§

fn from(node: StmtAssert) -> Self

Converts to this type from the input type.
Source§

impl From<StmtAssign> for Stmt

Source§

fn from(node: StmtAssign) -> Self

Converts to this type from the input type.
Source§

impl From<StmtAugAssign> for Stmt

Source§

fn from(node: StmtAugAssign) -> Self

Converts to this type from the input type.
Source§

impl From<StmtBreak> for Stmt

Source§

fn from(node: StmtBreak) -> Self

Converts to this type from the input type.
Source§

impl From<StmtClassDef> for Stmt

Source§

fn from(node: StmtClassDef) -> Self

Converts to this type from the input type.
Source§

impl From<StmtContinue> for Stmt

Source§

fn from(node: StmtContinue) -> Self

Converts to this type from the input type.
Source§

impl From<StmtDelete> for Stmt

Source§

fn from(node: StmtDelete) -> Self

Converts to this type from the input type.
Source§

impl From<StmtExpr> for Stmt

Source§

fn from(node: StmtExpr) -> Self

Converts to this type from the input type.
Source§

impl From<StmtFor> for Stmt

Source§

fn from(node: StmtFor) -> Self

Converts to this type from the input type.
Source§

impl From<StmtFunctionDef> for Stmt

Source§

fn from(node: StmtFunctionDef) -> Self

Converts to this type from the input type.
Source§

impl From<StmtGlobal> for Stmt

Source§

fn from(node: StmtGlobal) -> Self

Converts to this type from the input type.
Source§

impl From<StmtIf> for Stmt

Source§

fn from(node: StmtIf) -> Self

Converts to this type from the input type.
Source§

impl From<StmtImport> for Stmt

Source§

fn from(node: StmtImport) -> Self

Converts to this type from the input type.
Source§

impl From<StmtImportFrom> for Stmt

Source§

fn from(node: StmtImportFrom) -> Self

Converts to this type from the input type.
Source§

impl From<StmtIpyEscapeCommand> for Stmt

Source§

fn from(node: StmtIpyEscapeCommand) -> Self

Converts to this type from the input type.
Source§

impl From<StmtMatch> for Stmt

Source§

fn from(node: StmtMatch) -> Self

Converts to this type from the input type.
Source§

impl From<StmtNonlocal> for Stmt

Source§

fn from(node: StmtNonlocal) -> Self

Converts to this type from the input type.
Source§

impl From<StmtPass> for Stmt

Source§

fn from(node: StmtPass) -> Self

Converts to this type from the input type.
Source§

impl From<StmtRaise> for Stmt

Source§

fn from(node: StmtRaise) -> Self

Converts to this type from the input type.
Source§

impl From<StmtReturn> for Stmt

Source§

fn from(node: StmtReturn) -> Self

Converts to this type from the input type.
Source§

impl From<StmtTry> for Stmt

Source§

fn from(node: StmtTry) -> Self

Converts to this type from the input type.
Source§

impl From<StmtTypeAlias> for Stmt

Source§

fn from(node: StmtTypeAlias) -> Self

Converts to this type from the input type.
Source§

impl From<StmtWhile> for Stmt

Source§

fn from(node: StmtWhile) -> Self

Converts to this type from the input type.
Source§

impl From<StmtWith> for Stmt

Source§

fn from(node: StmtWith) -> Self

Converts to this type from the input type.
Source§

impl HasNodeIndex for Stmt

Source§

fn node_index(&self) -> &AtomicNodeIndex

Returns the AtomicNodeIndex for this node.
Source§

impl Identifier for Stmt

Source§

fn identifier(&self) -> TextRange

Return the TextRange of the identifier in the given statement.

For example, return the range of f in:

def f():
    ...
Source§

impl PartialEq for Stmt

Source§

fn eq(&self, other: &Stmt) -> 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 Ranged for Stmt

Source§

fn range(&self) -> TextRange

The range of this item in the source text.
Source§

fn start(&self) -> TextSize

The start offset of this item in the source text.
Source§

fn end(&self) -> TextSize

The end offset of this item in the source text.
Source§

impl<'a> TryFrom<AnyRootNodeRef<'a>> for &'a Stmt

Source§

type Error = ()

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

fn try_from(node: AnyRootNodeRef<'a>) -> Result<&'a Stmt, ()>

Performs the conversion.
Source§

impl StructuralPartialEq for Stmt

Auto Trait Implementations§

§

impl !Freeze for Stmt

§

impl RefUnwindSafe for Stmt

§

impl Send for Stmt

§

impl Sync for Stmt

§

impl Unpin for Stmt

§

impl UnsafeUnpin for Stmt

§

impl UnwindSafe for Stmt

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