Enum rustpython_ast::Stmt
source · pub enum Stmt<R = TextRange> {
Show 28 variants
FunctionDef(StmtFunctionDef<R>),
AsyncFunctionDef(StmtAsyncFunctionDef<R>),
ClassDef(StmtClassDef<R>),
Return(StmtReturn<R>),
Delete(StmtDelete<R>),
Assign(StmtAssign<R>),
TypeAlias(StmtTypeAlias<R>),
AugAssign(StmtAugAssign<R>),
AnnAssign(StmtAnnAssign<R>),
For(StmtFor<R>),
AsyncFor(StmtAsyncFor<R>),
While(StmtWhile<R>),
If(StmtIf<R>),
With(StmtWith<R>),
AsyncWith(StmtAsyncWith<R>),
Match(StmtMatch<R>),
Raise(StmtRaise<R>),
Try(StmtTry<R>),
TryStar(StmtTryStar<R>),
Assert(StmtAssert<R>),
Import(StmtImport<R>),
ImportFrom(StmtImportFrom<R>),
Global(StmtGlobal<R>),
Nonlocal(StmtNonlocal<R>),
Expr(StmtExpr<R>),
Pass(StmtPass<R>),
Break(StmtBreak<R>),
Continue(StmtContinue<R>),
}
Expand description
See also stmt
Variants§
FunctionDef(StmtFunctionDef<R>)
AsyncFunctionDef(StmtAsyncFunctionDef<R>)
ClassDef(StmtClassDef<R>)
Return(StmtReturn<R>)
Delete(StmtDelete<R>)
Assign(StmtAssign<R>)
TypeAlias(StmtTypeAlias<R>)
AugAssign(StmtAugAssign<R>)
AnnAssign(StmtAnnAssign<R>)
For(StmtFor<R>)
AsyncFor(StmtAsyncFor<R>)
While(StmtWhile<R>)
If(StmtIf<R>)
With(StmtWith<R>)
AsyncWith(StmtAsyncWith<R>)
Match(StmtMatch<R>)
Raise(StmtRaise<R>)
Try(StmtTry<R>)
TryStar(StmtTryStar<R>)
Assert(StmtAssert<R>)
Import(StmtImport<R>)
ImportFrom(StmtImportFrom<R>)
Global(StmtGlobal<R>)
Nonlocal(StmtNonlocal<R>)
Expr(StmtExpr<R>)
Pass(StmtPass<R>)
Break(StmtBreak<R>)
Continue(StmtContinue<R>)
Implementations§
source§impl<R> Stmt<R>
impl<R> Stmt<R>
sourcepub const fn is_function_def_stmt(&self) -> bool
pub const fn is_function_def_stmt(&self) -> bool
Returns true
if self
is of variant FunctionDef
.
sourcepub fn as_function_def_stmt(&self) -> Option<&StmtFunctionDef<R>>
pub fn as_function_def_stmt(&self) -> Option<&StmtFunctionDef<R>>
Returns Some
if self
is a reference of variant FunctionDef
, and None
otherwise.
sourcepub fn as_mut_function_def_stmt(&mut self) -> Option<&mut StmtFunctionDef<R>>
pub fn as_mut_function_def_stmt(&mut self) -> Option<&mut StmtFunctionDef<R>>
Returns Some
if self
is a mutable reference of variant FunctionDef
, and None
otherwise.
sourcepub fn expect_function_def_stmt(self) -> StmtFunctionDef<R>where
Self: Debug,
pub fn expect_function_def_stmt(self) -> StmtFunctionDef<R>where
Self: Debug,
Unwraps the value, yielding the content of FunctionDef
.
§Panics
Panics if the value is not FunctionDef
, with a panic message including the content of self
.
sourcepub fn function_def_stmt(self) -> Option<StmtFunctionDef<R>>
pub fn function_def_stmt(self) -> Option<StmtFunctionDef<R>>
Returns Some
if self
is of variant FunctionDef
, and None
otherwise.
sourcepub const fn is_async_function_def_stmt(&self) -> bool
pub const fn is_async_function_def_stmt(&self) -> bool
Returns true
if self
is of variant AsyncFunctionDef
.
sourcepub fn as_async_function_def_stmt(&self) -> Option<&StmtAsyncFunctionDef<R>>
pub fn as_async_function_def_stmt(&self) -> Option<&StmtAsyncFunctionDef<R>>
Returns Some
if self
is a reference of variant AsyncFunctionDef
, and None
otherwise.
sourcepub fn as_mut_async_function_def_stmt(
&mut self,
) -> Option<&mut StmtAsyncFunctionDef<R>>
pub fn as_mut_async_function_def_stmt( &mut self, ) -> Option<&mut StmtAsyncFunctionDef<R>>
Returns Some
if self
is a mutable reference of variant AsyncFunctionDef
, and None
otherwise.
sourcepub fn expect_async_function_def_stmt(self) -> StmtAsyncFunctionDef<R>where
Self: Debug,
pub fn expect_async_function_def_stmt(self) -> StmtAsyncFunctionDef<R>where
Self: Debug,
Unwraps the value, yielding the content of AsyncFunctionDef
.
§Panics
Panics if the value is not AsyncFunctionDef
, with a panic message including the content of self
.
sourcepub fn async_function_def_stmt(self) -> Option<StmtAsyncFunctionDef<R>>
pub fn async_function_def_stmt(self) -> Option<StmtAsyncFunctionDef<R>>
Returns Some
if self
is of variant AsyncFunctionDef
, and None
otherwise.
sourcepub const fn is_class_def_stmt(&self) -> bool
pub const fn is_class_def_stmt(&self) -> bool
Returns true
if self
is of variant ClassDef
.
sourcepub fn as_class_def_stmt(&self) -> Option<&StmtClassDef<R>>
pub fn as_class_def_stmt(&self) -> Option<&StmtClassDef<R>>
Returns Some
if self
is a reference of variant ClassDef
, and None
otherwise.
sourcepub fn as_mut_class_def_stmt(&mut self) -> Option<&mut StmtClassDef<R>>
pub fn as_mut_class_def_stmt(&mut self) -> Option<&mut StmtClassDef<R>>
Returns Some
if self
is a mutable reference of variant ClassDef
, and None
otherwise.
sourcepub fn expect_class_def_stmt(self) -> StmtClassDef<R>where
Self: Debug,
pub fn expect_class_def_stmt(self) -> StmtClassDef<R>where
Self: Debug,
sourcepub fn class_def_stmt(self) -> Option<StmtClassDef<R>>
pub fn class_def_stmt(self) -> Option<StmtClassDef<R>>
Returns Some
if self
is of variant ClassDef
, and None
otherwise.
sourcepub const fn is_return_stmt(&self) -> bool
pub const fn is_return_stmt(&self) -> bool
Returns true
if self
is of variant Return
.
sourcepub fn as_return_stmt(&self) -> Option<&StmtReturn<R>>
pub fn as_return_stmt(&self) -> Option<&StmtReturn<R>>
Returns Some
if self
is a reference of variant Return
, and None
otherwise.
sourcepub fn as_mut_return_stmt(&mut self) -> Option<&mut StmtReturn<R>>
pub fn as_mut_return_stmt(&mut self) -> Option<&mut StmtReturn<R>>
Returns Some
if self
is a mutable reference of variant Return
, and None
otherwise.
sourcepub fn expect_return_stmt(self) -> StmtReturn<R>where
Self: Debug,
pub fn expect_return_stmt(self) -> StmtReturn<R>where
Self: Debug,
sourcepub fn return_stmt(self) -> Option<StmtReturn<R>>
pub fn return_stmt(self) -> Option<StmtReturn<R>>
Returns Some
if self
is of variant Return
, and None
otherwise.
sourcepub const fn is_delete_stmt(&self) -> bool
pub const fn is_delete_stmt(&self) -> bool
Returns true
if self
is of variant Delete
.
sourcepub fn as_delete_stmt(&self) -> Option<&StmtDelete<R>>
pub fn as_delete_stmt(&self) -> Option<&StmtDelete<R>>
Returns Some
if self
is a reference of variant Delete
, and None
otherwise.
sourcepub fn as_mut_delete_stmt(&mut self) -> Option<&mut StmtDelete<R>>
pub fn as_mut_delete_stmt(&mut self) -> Option<&mut StmtDelete<R>>
Returns Some
if self
is a mutable reference of variant Delete
, and None
otherwise.
sourcepub fn expect_delete_stmt(self) -> StmtDelete<R>where
Self: Debug,
pub fn expect_delete_stmt(self) -> StmtDelete<R>where
Self: Debug,
sourcepub fn delete_stmt(self) -> Option<StmtDelete<R>>
pub fn delete_stmt(self) -> Option<StmtDelete<R>>
Returns Some
if self
is of variant Delete
, and None
otherwise.
sourcepub const fn is_assign_stmt(&self) -> bool
pub const fn is_assign_stmt(&self) -> bool
Returns true
if self
is of variant Assign
.
sourcepub fn as_assign_stmt(&self) -> Option<&StmtAssign<R>>
pub fn as_assign_stmt(&self) -> Option<&StmtAssign<R>>
Returns Some
if self
is a reference of variant Assign
, and None
otherwise.
sourcepub fn as_mut_assign_stmt(&mut self) -> Option<&mut StmtAssign<R>>
pub fn as_mut_assign_stmt(&mut self) -> Option<&mut StmtAssign<R>>
Returns Some
if self
is a mutable reference of variant Assign
, and None
otherwise.
sourcepub fn expect_assign_stmt(self) -> StmtAssign<R>where
Self: Debug,
pub fn expect_assign_stmt(self) -> StmtAssign<R>where
Self: Debug,
sourcepub fn assign_stmt(self) -> Option<StmtAssign<R>>
pub fn assign_stmt(self) -> Option<StmtAssign<R>>
Returns Some
if self
is of variant Assign
, and None
otherwise.
sourcepub const fn is_type_alias_stmt(&self) -> bool
pub const fn is_type_alias_stmt(&self) -> bool
Returns true
if self
is of variant TypeAlias
.
sourcepub fn as_type_alias_stmt(&self) -> Option<&StmtTypeAlias<R>>
pub fn as_type_alias_stmt(&self) -> Option<&StmtTypeAlias<R>>
Returns Some
if self
is a reference of variant TypeAlias
, and None
otherwise.
sourcepub fn as_mut_type_alias_stmt(&mut self) -> Option<&mut StmtTypeAlias<R>>
pub fn as_mut_type_alias_stmt(&mut self) -> Option<&mut StmtTypeAlias<R>>
Returns Some
if self
is a mutable reference of variant TypeAlias
, and None
otherwise.
sourcepub fn expect_type_alias_stmt(self) -> StmtTypeAlias<R>where
Self: Debug,
pub fn expect_type_alias_stmt(self) -> StmtTypeAlias<R>where
Self: Debug,
sourcepub fn type_alias_stmt(self) -> Option<StmtTypeAlias<R>>
pub fn type_alias_stmt(self) -> Option<StmtTypeAlias<R>>
Returns Some
if self
is of variant TypeAlias
, and None
otherwise.
sourcepub const fn is_aug_assign_stmt(&self) -> bool
pub const fn is_aug_assign_stmt(&self) -> bool
Returns true
if self
is of variant AugAssign
.
sourcepub fn as_aug_assign_stmt(&self) -> Option<&StmtAugAssign<R>>
pub fn as_aug_assign_stmt(&self) -> Option<&StmtAugAssign<R>>
Returns Some
if self
is a reference of variant AugAssign
, and None
otherwise.
sourcepub fn as_mut_aug_assign_stmt(&mut self) -> Option<&mut StmtAugAssign<R>>
pub fn as_mut_aug_assign_stmt(&mut self) -> Option<&mut StmtAugAssign<R>>
Returns Some
if self
is a mutable reference of variant AugAssign
, and None
otherwise.
sourcepub fn expect_aug_assign_stmt(self) -> StmtAugAssign<R>where
Self: Debug,
pub fn expect_aug_assign_stmt(self) -> StmtAugAssign<R>where
Self: Debug,
sourcepub fn aug_assign_stmt(self) -> Option<StmtAugAssign<R>>
pub fn aug_assign_stmt(self) -> Option<StmtAugAssign<R>>
Returns Some
if self
is of variant AugAssign
, and None
otherwise.
sourcepub const fn is_ann_assign_stmt(&self) -> bool
pub const fn is_ann_assign_stmt(&self) -> bool
Returns true
if self
is of variant AnnAssign
.
sourcepub fn as_ann_assign_stmt(&self) -> Option<&StmtAnnAssign<R>>
pub fn as_ann_assign_stmt(&self) -> Option<&StmtAnnAssign<R>>
Returns Some
if self
is a reference of variant AnnAssign
, and None
otherwise.
sourcepub fn as_mut_ann_assign_stmt(&mut self) -> Option<&mut StmtAnnAssign<R>>
pub fn as_mut_ann_assign_stmt(&mut self) -> Option<&mut StmtAnnAssign<R>>
Returns Some
if self
is a mutable reference of variant AnnAssign
, and None
otherwise.
sourcepub fn expect_ann_assign_stmt(self) -> StmtAnnAssign<R>where
Self: Debug,
pub fn expect_ann_assign_stmt(self) -> StmtAnnAssign<R>where
Self: Debug,
sourcepub fn ann_assign_stmt(self) -> Option<StmtAnnAssign<R>>
pub fn ann_assign_stmt(self) -> Option<StmtAnnAssign<R>>
Returns Some
if self
is of variant AnnAssign
, and None
otherwise.
sourcepub const fn is_for_stmt(&self) -> bool
pub const fn is_for_stmt(&self) -> bool
Returns true
if self
is of variant For
.
sourcepub fn as_for_stmt(&self) -> Option<&StmtFor<R>>
pub fn as_for_stmt(&self) -> Option<&StmtFor<R>>
Returns Some
if self
is a reference of variant For
, and None
otherwise.
sourcepub fn as_mut_for_stmt(&mut self) -> Option<&mut StmtFor<R>>
pub fn as_mut_for_stmt(&mut self) -> Option<&mut StmtFor<R>>
Returns Some
if self
is a mutable reference of variant For
, and None
otherwise.
sourcepub fn expect_for_stmt(self) -> StmtFor<R>where
Self: Debug,
pub fn expect_for_stmt(self) -> StmtFor<R>where
Self: Debug,
sourcepub fn for_stmt(self) -> Option<StmtFor<R>>
pub fn for_stmt(self) -> Option<StmtFor<R>>
Returns Some
if self
is of variant For
, and None
otherwise.
sourcepub const fn is_async_for_stmt(&self) -> bool
pub const fn is_async_for_stmt(&self) -> bool
Returns true
if self
is of variant AsyncFor
.
sourcepub fn as_async_for_stmt(&self) -> Option<&StmtAsyncFor<R>>
pub fn as_async_for_stmt(&self) -> Option<&StmtAsyncFor<R>>
Returns Some
if self
is a reference of variant AsyncFor
, and None
otherwise.
sourcepub fn as_mut_async_for_stmt(&mut self) -> Option<&mut StmtAsyncFor<R>>
pub fn as_mut_async_for_stmt(&mut self) -> Option<&mut StmtAsyncFor<R>>
Returns Some
if self
is a mutable reference of variant AsyncFor
, and None
otherwise.
sourcepub fn expect_async_for_stmt(self) -> StmtAsyncFor<R>where
Self: Debug,
pub fn expect_async_for_stmt(self) -> StmtAsyncFor<R>where
Self: Debug,
sourcepub fn async_for_stmt(self) -> Option<StmtAsyncFor<R>>
pub fn async_for_stmt(self) -> Option<StmtAsyncFor<R>>
Returns Some
if self
is of variant AsyncFor
, and None
otherwise.
sourcepub const fn is_while_stmt(&self) -> bool
pub const fn is_while_stmt(&self) -> bool
Returns true
if self
is of variant While
.
sourcepub fn as_while_stmt(&self) -> Option<&StmtWhile<R>>
pub fn as_while_stmt(&self) -> Option<&StmtWhile<R>>
Returns Some
if self
is a reference of variant While
, and None
otherwise.
sourcepub fn as_mut_while_stmt(&mut self) -> Option<&mut StmtWhile<R>>
pub fn as_mut_while_stmt(&mut self) -> Option<&mut StmtWhile<R>>
Returns Some
if self
is a mutable reference of variant While
, and None
otherwise.
sourcepub fn expect_while_stmt(self) -> StmtWhile<R>where
Self: Debug,
pub fn expect_while_stmt(self) -> StmtWhile<R>where
Self: Debug,
sourcepub fn while_stmt(self) -> Option<StmtWhile<R>>
pub fn while_stmt(self) -> Option<StmtWhile<R>>
Returns Some
if self
is of variant While
, and None
otherwise.
sourcepub const fn is_if_stmt(&self) -> bool
pub const fn is_if_stmt(&self) -> bool
Returns true
if self
is of variant If
.
sourcepub fn as_if_stmt(&self) -> Option<&StmtIf<R>>
pub fn as_if_stmt(&self) -> Option<&StmtIf<R>>
Returns Some
if self
is a reference of variant If
, and None
otherwise.
sourcepub fn as_mut_if_stmt(&mut self) -> Option<&mut StmtIf<R>>
pub fn as_mut_if_stmt(&mut self) -> Option<&mut StmtIf<R>>
Returns Some
if self
is a mutable reference of variant If
, and None
otherwise.
sourcepub fn expect_if_stmt(self) -> StmtIf<R>where
Self: Debug,
pub fn expect_if_stmt(self) -> StmtIf<R>where
Self: Debug,
sourcepub fn if_stmt(self) -> Option<StmtIf<R>>
pub fn if_stmt(self) -> Option<StmtIf<R>>
Returns Some
if self
is of variant If
, and None
otherwise.
sourcepub const fn is_with_stmt(&self) -> bool
pub const fn is_with_stmt(&self) -> bool
Returns true
if self
is of variant With
.
sourcepub fn as_with_stmt(&self) -> Option<&StmtWith<R>>
pub fn as_with_stmt(&self) -> Option<&StmtWith<R>>
Returns Some
if self
is a reference of variant With
, and None
otherwise.
sourcepub fn as_mut_with_stmt(&mut self) -> Option<&mut StmtWith<R>>
pub fn as_mut_with_stmt(&mut self) -> Option<&mut StmtWith<R>>
Returns Some
if self
is a mutable reference of variant With
, and None
otherwise.
sourcepub fn expect_with_stmt(self) -> StmtWith<R>where
Self: Debug,
pub fn expect_with_stmt(self) -> StmtWith<R>where
Self: Debug,
sourcepub fn with_stmt(self) -> Option<StmtWith<R>>
pub fn with_stmt(self) -> Option<StmtWith<R>>
Returns Some
if self
is of variant With
, and None
otherwise.
sourcepub const fn is_async_with_stmt(&self) -> bool
pub const fn is_async_with_stmt(&self) -> bool
Returns true
if self
is of variant AsyncWith
.
sourcepub fn as_async_with_stmt(&self) -> Option<&StmtAsyncWith<R>>
pub fn as_async_with_stmt(&self) -> Option<&StmtAsyncWith<R>>
Returns Some
if self
is a reference of variant AsyncWith
, and None
otherwise.
sourcepub fn as_mut_async_with_stmt(&mut self) -> Option<&mut StmtAsyncWith<R>>
pub fn as_mut_async_with_stmt(&mut self) -> Option<&mut StmtAsyncWith<R>>
Returns Some
if self
is a mutable reference of variant AsyncWith
, and None
otherwise.
sourcepub fn expect_async_with_stmt(self) -> StmtAsyncWith<R>where
Self: Debug,
pub fn expect_async_with_stmt(self) -> StmtAsyncWith<R>where
Self: Debug,
sourcepub fn async_with_stmt(self) -> Option<StmtAsyncWith<R>>
pub fn async_with_stmt(self) -> Option<StmtAsyncWith<R>>
Returns Some
if self
is of variant AsyncWith
, and None
otherwise.
sourcepub const fn is_match_stmt(&self) -> bool
pub const fn is_match_stmt(&self) -> bool
Returns true
if self
is of variant Match
.
sourcepub fn as_match_stmt(&self) -> Option<&StmtMatch<R>>
pub fn as_match_stmt(&self) -> Option<&StmtMatch<R>>
Returns Some
if self
is a reference of variant Match
, and None
otherwise.
sourcepub fn as_mut_match_stmt(&mut self) -> Option<&mut StmtMatch<R>>
pub fn as_mut_match_stmt(&mut self) -> Option<&mut StmtMatch<R>>
Returns Some
if self
is a mutable reference of variant Match
, and None
otherwise.
sourcepub fn expect_match_stmt(self) -> StmtMatch<R>where
Self: Debug,
pub fn expect_match_stmt(self) -> StmtMatch<R>where
Self: Debug,
sourcepub fn match_stmt(self) -> Option<StmtMatch<R>>
pub fn match_stmt(self) -> Option<StmtMatch<R>>
Returns Some
if self
is of variant Match
, and None
otherwise.
sourcepub const fn is_raise_stmt(&self) -> bool
pub const fn is_raise_stmt(&self) -> bool
Returns true
if self
is of variant Raise
.
sourcepub fn as_raise_stmt(&self) -> Option<&StmtRaise<R>>
pub fn as_raise_stmt(&self) -> Option<&StmtRaise<R>>
Returns Some
if self
is a reference of variant Raise
, and None
otherwise.
sourcepub fn as_mut_raise_stmt(&mut self) -> Option<&mut StmtRaise<R>>
pub fn as_mut_raise_stmt(&mut self) -> Option<&mut StmtRaise<R>>
Returns Some
if self
is a mutable reference of variant Raise
, and None
otherwise.
sourcepub fn expect_raise_stmt(self) -> StmtRaise<R>where
Self: Debug,
pub fn expect_raise_stmt(self) -> StmtRaise<R>where
Self: Debug,
sourcepub fn raise_stmt(self) -> Option<StmtRaise<R>>
pub fn raise_stmt(self) -> Option<StmtRaise<R>>
Returns Some
if self
is of variant Raise
, and None
otherwise.
sourcepub const fn is_try_stmt(&self) -> bool
pub const fn is_try_stmt(&self) -> bool
Returns true
if self
is of variant Try
.
sourcepub fn as_try_stmt(&self) -> Option<&StmtTry<R>>
pub fn as_try_stmt(&self) -> Option<&StmtTry<R>>
Returns Some
if self
is a reference of variant Try
, and None
otherwise.
sourcepub fn as_mut_try_stmt(&mut self) -> Option<&mut StmtTry<R>>
pub fn as_mut_try_stmt(&mut self) -> Option<&mut StmtTry<R>>
Returns Some
if self
is a mutable reference of variant Try
, and None
otherwise.
sourcepub fn expect_try_stmt(self) -> StmtTry<R>where
Self: Debug,
pub fn expect_try_stmt(self) -> StmtTry<R>where
Self: Debug,
sourcepub fn try_stmt(self) -> Option<StmtTry<R>>
pub fn try_stmt(self) -> Option<StmtTry<R>>
Returns Some
if self
is of variant Try
, and None
otherwise.
sourcepub const fn is_try_star_stmt(&self) -> bool
pub const fn is_try_star_stmt(&self) -> bool
Returns true
if self
is of variant TryStar
.
sourcepub fn as_try_star_stmt(&self) -> Option<&StmtTryStar<R>>
pub fn as_try_star_stmt(&self) -> Option<&StmtTryStar<R>>
Returns Some
if self
is a reference of variant TryStar
, and None
otherwise.
sourcepub fn as_mut_try_star_stmt(&mut self) -> Option<&mut StmtTryStar<R>>
pub fn as_mut_try_star_stmt(&mut self) -> Option<&mut StmtTryStar<R>>
Returns Some
if self
is a mutable reference of variant TryStar
, and None
otherwise.
sourcepub fn expect_try_star_stmt(self) -> StmtTryStar<R>where
Self: Debug,
pub fn expect_try_star_stmt(self) -> StmtTryStar<R>where
Self: Debug,
sourcepub fn try_star_stmt(self) -> Option<StmtTryStar<R>>
pub fn try_star_stmt(self) -> Option<StmtTryStar<R>>
Returns Some
if self
is of variant TryStar
, and None
otherwise.
sourcepub const fn is_assert_stmt(&self) -> bool
pub const fn is_assert_stmt(&self) -> bool
Returns true
if self
is of variant Assert
.
sourcepub fn as_assert_stmt(&self) -> Option<&StmtAssert<R>>
pub fn as_assert_stmt(&self) -> Option<&StmtAssert<R>>
Returns Some
if self
is a reference of variant Assert
, and None
otherwise.
sourcepub fn as_mut_assert_stmt(&mut self) -> Option<&mut StmtAssert<R>>
pub fn as_mut_assert_stmt(&mut self) -> Option<&mut StmtAssert<R>>
Returns Some
if self
is a mutable reference of variant Assert
, and None
otherwise.
sourcepub fn expect_assert_stmt(self) -> StmtAssert<R>where
Self: Debug,
pub fn expect_assert_stmt(self) -> StmtAssert<R>where
Self: Debug,
sourcepub fn assert_stmt(self) -> Option<StmtAssert<R>>
pub fn assert_stmt(self) -> Option<StmtAssert<R>>
Returns Some
if self
is of variant Assert
, and None
otherwise.
sourcepub const fn is_import_stmt(&self) -> bool
pub const fn is_import_stmt(&self) -> bool
Returns true
if self
is of variant Import
.
sourcepub fn as_import_stmt(&self) -> Option<&StmtImport<R>>
pub fn as_import_stmt(&self) -> Option<&StmtImport<R>>
Returns Some
if self
is a reference of variant Import
, and None
otherwise.
sourcepub fn as_mut_import_stmt(&mut self) -> Option<&mut StmtImport<R>>
pub fn as_mut_import_stmt(&mut self) -> Option<&mut StmtImport<R>>
Returns Some
if self
is a mutable reference of variant Import
, and None
otherwise.
sourcepub fn expect_import_stmt(self) -> StmtImport<R>where
Self: Debug,
pub fn expect_import_stmt(self) -> StmtImport<R>where
Self: Debug,
sourcepub fn import_stmt(self) -> Option<StmtImport<R>>
pub fn import_stmt(self) -> Option<StmtImport<R>>
Returns Some
if self
is of variant Import
, and None
otherwise.
sourcepub const fn is_import_from_stmt(&self) -> bool
pub const fn is_import_from_stmt(&self) -> bool
Returns true
if self
is of variant ImportFrom
.
sourcepub fn as_import_from_stmt(&self) -> Option<&StmtImportFrom<R>>
pub fn as_import_from_stmt(&self) -> Option<&StmtImportFrom<R>>
Returns Some
if self
is a reference of variant ImportFrom
, and None
otherwise.
sourcepub fn as_mut_import_from_stmt(&mut self) -> Option<&mut StmtImportFrom<R>>
pub fn as_mut_import_from_stmt(&mut self) -> Option<&mut StmtImportFrom<R>>
Returns Some
if self
is a mutable reference of variant ImportFrom
, and None
otherwise.
sourcepub fn expect_import_from_stmt(self) -> StmtImportFrom<R>where
Self: Debug,
pub fn expect_import_from_stmt(self) -> StmtImportFrom<R>where
Self: Debug,
Unwraps the value, yielding the content of ImportFrom
.
§Panics
Panics if the value is not ImportFrom
, with a panic message including the content of self
.
sourcepub fn import_from_stmt(self) -> Option<StmtImportFrom<R>>
pub fn import_from_stmt(self) -> Option<StmtImportFrom<R>>
Returns Some
if self
is of variant ImportFrom
, and None
otherwise.
sourcepub const fn is_global_stmt(&self) -> bool
pub const fn is_global_stmt(&self) -> bool
Returns true
if self
is of variant Global
.
sourcepub fn as_global_stmt(&self) -> Option<&StmtGlobal<R>>
pub fn as_global_stmt(&self) -> Option<&StmtGlobal<R>>
Returns Some
if self
is a reference of variant Global
, and None
otherwise.
sourcepub fn as_mut_global_stmt(&mut self) -> Option<&mut StmtGlobal<R>>
pub fn as_mut_global_stmt(&mut self) -> Option<&mut StmtGlobal<R>>
Returns Some
if self
is a mutable reference of variant Global
, and None
otherwise.
sourcepub fn expect_global_stmt(self) -> StmtGlobal<R>where
Self: Debug,
pub fn expect_global_stmt(self) -> StmtGlobal<R>where
Self: Debug,
sourcepub fn global_stmt(self) -> Option<StmtGlobal<R>>
pub fn global_stmt(self) -> Option<StmtGlobal<R>>
Returns Some
if self
is of variant Global
, and None
otherwise.
sourcepub const fn is_nonlocal_stmt(&self) -> bool
pub const fn is_nonlocal_stmt(&self) -> bool
Returns true
if self
is of variant Nonlocal
.
sourcepub fn as_nonlocal_stmt(&self) -> Option<&StmtNonlocal<R>>
pub fn as_nonlocal_stmt(&self) -> Option<&StmtNonlocal<R>>
Returns Some
if self
is a reference of variant Nonlocal
, and None
otherwise.
sourcepub fn as_mut_nonlocal_stmt(&mut self) -> Option<&mut StmtNonlocal<R>>
pub fn as_mut_nonlocal_stmt(&mut self) -> Option<&mut StmtNonlocal<R>>
Returns Some
if self
is a mutable reference of variant Nonlocal
, and None
otherwise.
sourcepub fn expect_nonlocal_stmt(self) -> StmtNonlocal<R>where
Self: Debug,
pub fn expect_nonlocal_stmt(self) -> StmtNonlocal<R>where
Self: Debug,
sourcepub fn nonlocal_stmt(self) -> Option<StmtNonlocal<R>>
pub fn nonlocal_stmt(self) -> Option<StmtNonlocal<R>>
Returns Some
if self
is of variant Nonlocal
, and None
otherwise.
sourcepub const fn is_expr_stmt(&self) -> bool
pub const fn is_expr_stmt(&self) -> bool
Returns true
if self
is of variant Expr
.
sourcepub fn as_expr_stmt(&self) -> Option<&StmtExpr<R>>
pub fn as_expr_stmt(&self) -> Option<&StmtExpr<R>>
Returns Some
if self
is a reference of variant Expr
, and None
otherwise.
sourcepub fn as_mut_expr_stmt(&mut self) -> Option<&mut StmtExpr<R>>
pub fn as_mut_expr_stmt(&mut self) -> Option<&mut StmtExpr<R>>
Returns Some
if self
is a mutable reference of variant Expr
, and None
otherwise.
sourcepub fn expect_expr_stmt(self) -> StmtExpr<R>where
Self: Debug,
pub fn expect_expr_stmt(self) -> StmtExpr<R>where
Self: Debug,
sourcepub fn expr_stmt(self) -> Option<StmtExpr<R>>
pub fn expr_stmt(self) -> Option<StmtExpr<R>>
Returns Some
if self
is of variant Expr
, and None
otherwise.
sourcepub const fn is_pass_stmt(&self) -> bool
pub const fn is_pass_stmt(&self) -> bool
Returns true
if self
is of variant Pass
.
sourcepub fn as_pass_stmt(&self) -> Option<&StmtPass<R>>
pub fn as_pass_stmt(&self) -> Option<&StmtPass<R>>
Returns Some
if self
is a reference of variant Pass
, and None
otherwise.
sourcepub fn as_mut_pass_stmt(&mut self) -> Option<&mut StmtPass<R>>
pub fn as_mut_pass_stmt(&mut self) -> Option<&mut StmtPass<R>>
Returns Some
if self
is a mutable reference of variant Pass
, and None
otherwise.
sourcepub fn expect_pass_stmt(self) -> StmtPass<R>where
Self: Debug,
pub fn expect_pass_stmt(self) -> StmtPass<R>where
Self: Debug,
sourcepub fn pass_stmt(self) -> Option<StmtPass<R>>
pub fn pass_stmt(self) -> Option<StmtPass<R>>
Returns Some
if self
is of variant Pass
, and None
otherwise.
sourcepub const fn is_break_stmt(&self) -> bool
pub const fn is_break_stmt(&self) -> bool
Returns true
if self
is of variant Break
.
sourcepub fn as_break_stmt(&self) -> Option<&StmtBreak<R>>
pub fn as_break_stmt(&self) -> Option<&StmtBreak<R>>
Returns Some
if self
is a reference of variant Break
, and None
otherwise.
sourcepub fn as_mut_break_stmt(&mut self) -> Option<&mut StmtBreak<R>>
pub fn as_mut_break_stmt(&mut self) -> Option<&mut StmtBreak<R>>
Returns Some
if self
is a mutable reference of variant Break
, and None
otherwise.
sourcepub fn expect_break_stmt(self) -> StmtBreak<R>where
Self: Debug,
pub fn expect_break_stmt(self) -> StmtBreak<R>where
Self: Debug,
sourcepub fn break_stmt(self) -> Option<StmtBreak<R>>
pub fn break_stmt(self) -> Option<StmtBreak<R>>
Returns Some
if self
is of variant Break
, and None
otherwise.
sourcepub const fn is_continue_stmt(&self) -> bool
pub const fn is_continue_stmt(&self) -> bool
Returns true
if self
is of variant Continue
.
sourcepub fn as_continue_stmt(&self) -> Option<&StmtContinue<R>>
pub fn as_continue_stmt(&self) -> Option<&StmtContinue<R>>
Returns Some
if self
is a reference of variant Continue
, and None
otherwise.
sourcepub fn as_mut_continue_stmt(&mut self) -> Option<&mut StmtContinue<R>>
pub fn as_mut_continue_stmt(&mut self) -> Option<&mut StmtContinue<R>>
Returns Some
if self
is a mutable reference of variant Continue
, and None
otherwise.
sourcepub fn expect_continue_stmt(self) -> StmtContinue<R>where
Self: Debug,
pub fn expect_continue_stmt(self) -> StmtContinue<R>where
Self: Debug,
sourcepub fn continue_stmt(self) -> Option<StmtContinue<R>>
pub fn continue_stmt(self) -> Option<StmtContinue<R>>
Returns Some
if self
is of variant Continue
, and None
otherwise.
Trait Implementations§
source§impl<R> From<StmtAnnAssign<R>> for Stmt<R>
impl<R> From<StmtAnnAssign<R>> for Stmt<R>
source§fn from(payload: StmtAnnAssign<R>) -> Self
fn from(payload: StmtAnnAssign<R>) -> Self
source§impl<R> From<StmtAssert<R>> for Stmt<R>
impl<R> From<StmtAssert<R>> for Stmt<R>
source§fn from(payload: StmtAssert<R>) -> Self
fn from(payload: StmtAssert<R>) -> Self
source§impl<R> From<StmtAssign<R>> for Stmt<R>
impl<R> From<StmtAssign<R>> for Stmt<R>
source§fn from(payload: StmtAssign<R>) -> Self
fn from(payload: StmtAssign<R>) -> Self
source§impl<R> From<StmtAsyncFor<R>> for Stmt<R>
impl<R> From<StmtAsyncFor<R>> for Stmt<R>
source§fn from(payload: StmtAsyncFor<R>) -> Self
fn from(payload: StmtAsyncFor<R>) -> Self
source§impl<R> From<StmtAsyncFunctionDef<R>> for Stmt<R>
impl<R> From<StmtAsyncFunctionDef<R>> for Stmt<R>
source§fn from(payload: StmtAsyncFunctionDef<R>) -> Self
fn from(payload: StmtAsyncFunctionDef<R>) -> Self
source§impl<R> From<StmtAsyncWith<R>> for Stmt<R>
impl<R> From<StmtAsyncWith<R>> for Stmt<R>
source§fn from(payload: StmtAsyncWith<R>) -> Self
fn from(payload: StmtAsyncWith<R>) -> Self
source§impl<R> From<StmtAugAssign<R>> for Stmt<R>
impl<R> From<StmtAugAssign<R>> for Stmt<R>
source§fn from(payload: StmtAugAssign<R>) -> Self
fn from(payload: StmtAugAssign<R>) -> Self
source§impl<R> From<StmtClassDef<R>> for Stmt<R>
impl<R> From<StmtClassDef<R>> for Stmt<R>
source§fn from(payload: StmtClassDef<R>) -> Self
fn from(payload: StmtClassDef<R>) -> Self
source§impl<R> From<StmtContinue<R>> for Stmt<R>
impl<R> From<StmtContinue<R>> for Stmt<R>
source§fn from(payload: StmtContinue<R>) -> Self
fn from(payload: StmtContinue<R>) -> Self
source§impl<R> From<StmtDelete<R>> for Stmt<R>
impl<R> From<StmtDelete<R>> for Stmt<R>
source§fn from(payload: StmtDelete<R>) -> Self
fn from(payload: StmtDelete<R>) -> Self
source§impl<R> From<StmtFunctionDef<R>> for Stmt<R>
impl<R> From<StmtFunctionDef<R>> for Stmt<R>
source§fn from(payload: StmtFunctionDef<R>) -> Self
fn from(payload: StmtFunctionDef<R>) -> Self
source§impl<R> From<StmtGlobal<R>> for Stmt<R>
impl<R> From<StmtGlobal<R>> for Stmt<R>
source§fn from(payload: StmtGlobal<R>) -> Self
fn from(payload: StmtGlobal<R>) -> Self
source§impl<R> From<StmtImport<R>> for Stmt<R>
impl<R> From<StmtImport<R>> for Stmt<R>
source§fn from(payload: StmtImport<R>) -> Self
fn from(payload: StmtImport<R>) -> Self
source§impl<R> From<StmtImportFrom<R>> for Stmt<R>
impl<R> From<StmtImportFrom<R>> for Stmt<R>
source§fn from(payload: StmtImportFrom<R>) -> Self
fn from(payload: StmtImportFrom<R>) -> Self
source§impl<R> From<StmtNonlocal<R>> for Stmt<R>
impl<R> From<StmtNonlocal<R>> for Stmt<R>
source§fn from(payload: StmtNonlocal<R>) -> Self
fn from(payload: StmtNonlocal<R>) -> Self
source§impl<R> From<StmtReturn<R>> for Stmt<R>
impl<R> From<StmtReturn<R>> for Stmt<R>
source§fn from(payload: StmtReturn<R>) -> Self
fn from(payload: StmtReturn<R>) -> Self
source§impl<R> From<StmtTryStar<R>> for Stmt<R>
impl<R> From<StmtTryStar<R>> for Stmt<R>
source§fn from(payload: StmtTryStar<R>) -> Self
fn from(payload: StmtTryStar<R>) -> Self
source§impl<R> From<StmtTypeAlias<R>> for Stmt<R>
impl<R> From<StmtTypeAlias<R>> for Stmt<R>
source§fn from(payload: StmtTypeAlias<R>) -> Self
fn from(payload: StmtTypeAlias<R>) -> Self
impl<R> StructuralPartialEq for Stmt<R>
Auto Trait Implementations§
impl<R> Freeze for Stmt<R>where
R: Freeze,
impl<R> RefUnwindSafe for Stmt<R>where
R: RefUnwindSafe,
impl<R> Send for Stmt<R>where
R: Send,
impl<R> Sync for Stmt<R>where
R: Sync,
impl<R> Unpin for Stmt<R>where
R: Unpin,
impl<R> UnwindSafe for Stmt<R>where
R: UnwindSafe,
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)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 more