Enum rustpython_ast::Expr
source · pub enum Expr<R = TextRange> {
Show 27 variants
BoolOp(ExprBoolOp<R>),
NamedExpr(ExprNamedExpr<R>),
BinOp(ExprBinOp<R>),
UnaryOp(ExprUnaryOp<R>),
Lambda(ExprLambda<R>),
IfExp(ExprIfExp<R>),
Dict(ExprDict<R>),
Set(ExprSet<R>),
ListComp(ExprListComp<R>),
SetComp(ExprSetComp<R>),
DictComp(ExprDictComp<R>),
GeneratorExp(ExprGeneratorExp<R>),
Await(ExprAwait<R>),
Yield(ExprYield<R>),
YieldFrom(ExprYieldFrom<R>),
Compare(ExprCompare<R>),
Call(ExprCall<R>),
FormattedValue(ExprFormattedValue<R>),
JoinedStr(ExprJoinedStr<R>),
Constant(ExprConstant<R>),
Attribute(ExprAttribute<R>),
Subscript(ExprSubscript<R>),
Starred(ExprStarred<R>),
Name(ExprName<R>),
List(ExprList<R>),
Tuple(ExprTuple<R>),
Slice(ExprSlice<R>),
}
Expand description
See also expr
Variants§
BoolOp(ExprBoolOp<R>)
NamedExpr(ExprNamedExpr<R>)
BinOp(ExprBinOp<R>)
UnaryOp(ExprUnaryOp<R>)
Lambda(ExprLambda<R>)
IfExp(ExprIfExp<R>)
Dict(ExprDict<R>)
Set(ExprSet<R>)
ListComp(ExprListComp<R>)
SetComp(ExprSetComp<R>)
DictComp(ExprDictComp<R>)
GeneratorExp(ExprGeneratorExp<R>)
Await(ExprAwait<R>)
Yield(ExprYield<R>)
YieldFrom(ExprYieldFrom<R>)
Compare(ExprCompare<R>)
Call(ExprCall<R>)
FormattedValue(ExprFormattedValue<R>)
JoinedStr(ExprJoinedStr<R>)
Constant(ExprConstant<R>)
Attribute(ExprAttribute<R>)
Subscript(ExprSubscript<R>)
Starred(ExprStarred<R>)
Name(ExprName<R>)
List(ExprList<R>)
Tuple(ExprTuple<R>)
Slice(ExprSlice<R>)
Implementations§
source§impl<R> Expr<R>
impl<R> Expr<R>
sourcepub const fn is_bool_op_expr(&self) -> bool
pub const fn is_bool_op_expr(&self) -> bool
Returns true
if self
is of variant BoolOp
.
sourcepub fn as_bool_op_expr(&self) -> Option<&ExprBoolOp<R>>
pub fn as_bool_op_expr(&self) -> Option<&ExprBoolOp<R>>
Returns Some
if self
is a reference of variant BoolOp
, and None
otherwise.
sourcepub fn as_mut_bool_op_expr(&mut self) -> Option<&mut ExprBoolOp<R>>
pub fn as_mut_bool_op_expr(&mut self) -> Option<&mut ExprBoolOp<R>>
Returns Some
if self
is a mutable reference of variant BoolOp
, and None
otherwise.
sourcepub fn expect_bool_op_expr(self) -> ExprBoolOp<R>where
Self: Debug,
pub fn expect_bool_op_expr(self) -> ExprBoolOp<R>where
Self: Debug,
sourcepub fn bool_op_expr(self) -> Option<ExprBoolOp<R>>
pub fn bool_op_expr(self) -> Option<ExprBoolOp<R>>
Returns Some
if self
is of variant BoolOp
, and None
otherwise.
sourcepub const fn is_named_expr_expr(&self) -> bool
pub const fn is_named_expr_expr(&self) -> bool
Returns true
if self
is of variant NamedExpr
.
sourcepub fn as_named_expr_expr(&self) -> Option<&ExprNamedExpr<R>>
pub fn as_named_expr_expr(&self) -> Option<&ExprNamedExpr<R>>
Returns Some
if self
is a reference of variant NamedExpr
, and None
otherwise.
sourcepub fn as_mut_named_expr_expr(&mut self) -> Option<&mut ExprNamedExpr<R>>
pub fn as_mut_named_expr_expr(&mut self) -> Option<&mut ExprNamedExpr<R>>
Returns Some
if self
is a mutable reference of variant NamedExpr
, and None
otherwise.
sourcepub fn expect_named_expr_expr(self) -> ExprNamedExpr<R>where
Self: Debug,
pub fn expect_named_expr_expr(self) -> ExprNamedExpr<R>where
Self: Debug,
sourcepub fn named_expr_expr(self) -> Option<ExprNamedExpr<R>>
pub fn named_expr_expr(self) -> Option<ExprNamedExpr<R>>
Returns Some
if self
is of variant NamedExpr
, and None
otherwise.
sourcepub const fn is_bin_op_expr(&self) -> bool
pub const fn is_bin_op_expr(&self) -> bool
Returns true
if self
is of variant BinOp
.
sourcepub fn as_bin_op_expr(&self) -> Option<&ExprBinOp<R>>
pub fn as_bin_op_expr(&self) -> Option<&ExprBinOp<R>>
Returns Some
if self
is a reference of variant BinOp
, and None
otherwise.
sourcepub fn as_mut_bin_op_expr(&mut self) -> Option<&mut ExprBinOp<R>>
pub fn as_mut_bin_op_expr(&mut self) -> Option<&mut ExprBinOp<R>>
Returns Some
if self
is a mutable reference of variant BinOp
, and None
otherwise.
sourcepub fn expect_bin_op_expr(self) -> ExprBinOp<R>where
Self: Debug,
pub fn expect_bin_op_expr(self) -> ExprBinOp<R>where
Self: Debug,
sourcepub fn bin_op_expr(self) -> Option<ExprBinOp<R>>
pub fn bin_op_expr(self) -> Option<ExprBinOp<R>>
Returns Some
if self
is of variant BinOp
, and None
otherwise.
sourcepub const fn is_unary_op_expr(&self) -> bool
pub const fn is_unary_op_expr(&self) -> bool
Returns true
if self
is of variant UnaryOp
.
sourcepub fn as_unary_op_expr(&self) -> Option<&ExprUnaryOp<R>>
pub fn as_unary_op_expr(&self) -> Option<&ExprUnaryOp<R>>
Returns Some
if self
is a reference of variant UnaryOp
, and None
otherwise.
sourcepub fn as_mut_unary_op_expr(&mut self) -> Option<&mut ExprUnaryOp<R>>
pub fn as_mut_unary_op_expr(&mut self) -> Option<&mut ExprUnaryOp<R>>
Returns Some
if self
is a mutable reference of variant UnaryOp
, and None
otherwise.
sourcepub fn expect_unary_op_expr(self) -> ExprUnaryOp<R>where
Self: Debug,
pub fn expect_unary_op_expr(self) -> ExprUnaryOp<R>where
Self: Debug,
sourcepub fn unary_op_expr(self) -> Option<ExprUnaryOp<R>>
pub fn unary_op_expr(self) -> Option<ExprUnaryOp<R>>
Returns Some
if self
is of variant UnaryOp
, and None
otherwise.
sourcepub const fn is_lambda_expr(&self) -> bool
pub const fn is_lambda_expr(&self) -> bool
Returns true
if self
is of variant Lambda
.
sourcepub fn as_lambda_expr(&self) -> Option<&ExprLambda<R>>
pub fn as_lambda_expr(&self) -> Option<&ExprLambda<R>>
Returns Some
if self
is a reference of variant Lambda
, and None
otherwise.
sourcepub fn as_mut_lambda_expr(&mut self) -> Option<&mut ExprLambda<R>>
pub fn as_mut_lambda_expr(&mut self) -> Option<&mut ExprLambda<R>>
Returns Some
if self
is a mutable reference of variant Lambda
, and None
otherwise.
sourcepub fn expect_lambda_expr(self) -> ExprLambda<R>where
Self: Debug,
pub fn expect_lambda_expr(self) -> ExprLambda<R>where
Self: Debug,
sourcepub fn lambda_expr(self) -> Option<ExprLambda<R>>
pub fn lambda_expr(self) -> Option<ExprLambda<R>>
Returns Some
if self
is of variant Lambda
, and None
otherwise.
sourcepub const fn is_if_exp_expr(&self) -> bool
pub const fn is_if_exp_expr(&self) -> bool
Returns true
if self
is of variant IfExp
.
sourcepub fn as_if_exp_expr(&self) -> Option<&ExprIfExp<R>>
pub fn as_if_exp_expr(&self) -> Option<&ExprIfExp<R>>
Returns Some
if self
is a reference of variant IfExp
, and None
otherwise.
sourcepub fn as_mut_if_exp_expr(&mut self) -> Option<&mut ExprIfExp<R>>
pub fn as_mut_if_exp_expr(&mut self) -> Option<&mut ExprIfExp<R>>
Returns Some
if self
is a mutable reference of variant IfExp
, and None
otherwise.
sourcepub fn expect_if_exp_expr(self) -> ExprIfExp<R>where
Self: Debug,
pub fn expect_if_exp_expr(self) -> ExprIfExp<R>where
Self: Debug,
sourcepub fn if_exp_expr(self) -> Option<ExprIfExp<R>>
pub fn if_exp_expr(self) -> Option<ExprIfExp<R>>
Returns Some
if self
is of variant IfExp
, and None
otherwise.
sourcepub const fn is_dict_expr(&self) -> bool
pub const fn is_dict_expr(&self) -> bool
Returns true
if self
is of variant Dict
.
sourcepub fn as_dict_expr(&self) -> Option<&ExprDict<R>>
pub fn as_dict_expr(&self) -> Option<&ExprDict<R>>
Returns Some
if self
is a reference of variant Dict
, and None
otherwise.
sourcepub fn as_mut_dict_expr(&mut self) -> Option<&mut ExprDict<R>>
pub fn as_mut_dict_expr(&mut self) -> Option<&mut ExprDict<R>>
Returns Some
if self
is a mutable reference of variant Dict
, and None
otherwise.
sourcepub fn expect_dict_expr(self) -> ExprDict<R>where
Self: Debug,
pub fn expect_dict_expr(self) -> ExprDict<R>where
Self: Debug,
sourcepub fn dict_expr(self) -> Option<ExprDict<R>>
pub fn dict_expr(self) -> Option<ExprDict<R>>
Returns Some
if self
is of variant Dict
, and None
otherwise.
sourcepub const fn is_set_expr(&self) -> bool
pub const fn is_set_expr(&self) -> bool
Returns true
if self
is of variant Set
.
sourcepub fn as_set_expr(&self) -> Option<&ExprSet<R>>
pub fn as_set_expr(&self) -> Option<&ExprSet<R>>
Returns Some
if self
is a reference of variant Set
, and None
otherwise.
sourcepub fn as_mut_set_expr(&mut self) -> Option<&mut ExprSet<R>>
pub fn as_mut_set_expr(&mut self) -> Option<&mut ExprSet<R>>
Returns Some
if self
is a mutable reference of variant Set
, and None
otherwise.
sourcepub fn expect_set_expr(self) -> ExprSet<R>where
Self: Debug,
pub fn expect_set_expr(self) -> ExprSet<R>where
Self: Debug,
sourcepub fn set_expr(self) -> Option<ExprSet<R>>
pub fn set_expr(self) -> Option<ExprSet<R>>
Returns Some
if self
is of variant Set
, and None
otherwise.
sourcepub const fn is_list_comp_expr(&self) -> bool
pub const fn is_list_comp_expr(&self) -> bool
Returns true
if self
is of variant ListComp
.
sourcepub fn as_list_comp_expr(&self) -> Option<&ExprListComp<R>>
pub fn as_list_comp_expr(&self) -> Option<&ExprListComp<R>>
Returns Some
if self
is a reference of variant ListComp
, and None
otherwise.
sourcepub fn as_mut_list_comp_expr(&mut self) -> Option<&mut ExprListComp<R>>
pub fn as_mut_list_comp_expr(&mut self) -> Option<&mut ExprListComp<R>>
Returns Some
if self
is a mutable reference of variant ListComp
, and None
otherwise.
sourcepub fn expect_list_comp_expr(self) -> ExprListComp<R>where
Self: Debug,
pub fn expect_list_comp_expr(self) -> ExprListComp<R>where
Self: Debug,
sourcepub fn list_comp_expr(self) -> Option<ExprListComp<R>>
pub fn list_comp_expr(self) -> Option<ExprListComp<R>>
Returns Some
if self
is of variant ListComp
, and None
otherwise.
sourcepub const fn is_set_comp_expr(&self) -> bool
pub const fn is_set_comp_expr(&self) -> bool
Returns true
if self
is of variant SetComp
.
sourcepub fn as_set_comp_expr(&self) -> Option<&ExprSetComp<R>>
pub fn as_set_comp_expr(&self) -> Option<&ExprSetComp<R>>
Returns Some
if self
is a reference of variant SetComp
, and None
otherwise.
sourcepub fn as_mut_set_comp_expr(&mut self) -> Option<&mut ExprSetComp<R>>
pub fn as_mut_set_comp_expr(&mut self) -> Option<&mut ExprSetComp<R>>
Returns Some
if self
is a mutable reference of variant SetComp
, and None
otherwise.
sourcepub fn expect_set_comp_expr(self) -> ExprSetComp<R>where
Self: Debug,
pub fn expect_set_comp_expr(self) -> ExprSetComp<R>where
Self: Debug,
sourcepub fn set_comp_expr(self) -> Option<ExprSetComp<R>>
pub fn set_comp_expr(self) -> Option<ExprSetComp<R>>
Returns Some
if self
is of variant SetComp
, and None
otherwise.
sourcepub const fn is_dict_comp_expr(&self) -> bool
pub const fn is_dict_comp_expr(&self) -> bool
Returns true
if self
is of variant DictComp
.
sourcepub fn as_dict_comp_expr(&self) -> Option<&ExprDictComp<R>>
pub fn as_dict_comp_expr(&self) -> Option<&ExprDictComp<R>>
Returns Some
if self
is a reference of variant DictComp
, and None
otherwise.
sourcepub fn as_mut_dict_comp_expr(&mut self) -> Option<&mut ExprDictComp<R>>
pub fn as_mut_dict_comp_expr(&mut self) -> Option<&mut ExprDictComp<R>>
Returns Some
if self
is a mutable reference of variant DictComp
, and None
otherwise.
sourcepub fn expect_dict_comp_expr(self) -> ExprDictComp<R>where
Self: Debug,
pub fn expect_dict_comp_expr(self) -> ExprDictComp<R>where
Self: Debug,
sourcepub fn dict_comp_expr(self) -> Option<ExprDictComp<R>>
pub fn dict_comp_expr(self) -> Option<ExprDictComp<R>>
Returns Some
if self
is of variant DictComp
, and None
otherwise.
sourcepub const fn is_generator_exp_expr(&self) -> bool
pub const fn is_generator_exp_expr(&self) -> bool
Returns true
if self
is of variant GeneratorExp
.
sourcepub fn as_generator_exp_expr(&self) -> Option<&ExprGeneratorExp<R>>
pub fn as_generator_exp_expr(&self) -> Option<&ExprGeneratorExp<R>>
Returns Some
if self
is a reference of variant GeneratorExp
, and None
otherwise.
sourcepub fn as_mut_generator_exp_expr(&mut self) -> Option<&mut ExprGeneratorExp<R>>
pub fn as_mut_generator_exp_expr(&mut self) -> Option<&mut ExprGeneratorExp<R>>
Returns Some
if self
is a mutable reference of variant GeneratorExp
, and None
otherwise.
sourcepub fn expect_generator_exp_expr(self) -> ExprGeneratorExp<R>where
Self: Debug,
pub fn expect_generator_exp_expr(self) -> ExprGeneratorExp<R>where
Self: Debug,
Unwraps the value, yielding the content of GeneratorExp
.
§Panics
Panics if the value is not GeneratorExp
, with a panic message including the content of self
.
sourcepub fn generator_exp_expr(self) -> Option<ExprGeneratorExp<R>>
pub fn generator_exp_expr(self) -> Option<ExprGeneratorExp<R>>
Returns Some
if self
is of variant GeneratorExp
, and None
otherwise.
sourcepub const fn is_await_expr(&self) -> bool
pub const fn is_await_expr(&self) -> bool
Returns true
if self
is of variant Await
.
sourcepub fn as_await_expr(&self) -> Option<&ExprAwait<R>>
pub fn as_await_expr(&self) -> Option<&ExprAwait<R>>
Returns Some
if self
is a reference of variant Await
, and None
otherwise.
sourcepub fn as_mut_await_expr(&mut self) -> Option<&mut ExprAwait<R>>
pub fn as_mut_await_expr(&mut self) -> Option<&mut ExprAwait<R>>
Returns Some
if self
is a mutable reference of variant Await
, and None
otherwise.
sourcepub fn expect_await_expr(self) -> ExprAwait<R>where
Self: Debug,
pub fn expect_await_expr(self) -> ExprAwait<R>where
Self: Debug,
sourcepub fn await_expr(self) -> Option<ExprAwait<R>>
pub fn await_expr(self) -> Option<ExprAwait<R>>
Returns Some
if self
is of variant Await
, and None
otherwise.
sourcepub const fn is_yield_expr(&self) -> bool
pub const fn is_yield_expr(&self) -> bool
Returns true
if self
is of variant Yield
.
sourcepub fn as_yield_expr(&self) -> Option<&ExprYield<R>>
pub fn as_yield_expr(&self) -> Option<&ExprYield<R>>
Returns Some
if self
is a reference of variant Yield
, and None
otherwise.
sourcepub fn as_mut_yield_expr(&mut self) -> Option<&mut ExprYield<R>>
pub fn as_mut_yield_expr(&mut self) -> Option<&mut ExprYield<R>>
Returns Some
if self
is a mutable reference of variant Yield
, and None
otherwise.
sourcepub fn expect_yield_expr(self) -> ExprYield<R>where
Self: Debug,
pub fn expect_yield_expr(self) -> ExprYield<R>where
Self: Debug,
sourcepub fn yield_expr(self) -> Option<ExprYield<R>>
pub fn yield_expr(self) -> Option<ExprYield<R>>
Returns Some
if self
is of variant Yield
, and None
otherwise.
sourcepub const fn is_yield_from_expr(&self) -> bool
pub const fn is_yield_from_expr(&self) -> bool
Returns true
if self
is of variant YieldFrom
.
sourcepub fn as_yield_from_expr(&self) -> Option<&ExprYieldFrom<R>>
pub fn as_yield_from_expr(&self) -> Option<&ExprYieldFrom<R>>
Returns Some
if self
is a reference of variant YieldFrom
, and None
otherwise.
sourcepub fn as_mut_yield_from_expr(&mut self) -> Option<&mut ExprYieldFrom<R>>
pub fn as_mut_yield_from_expr(&mut self) -> Option<&mut ExprYieldFrom<R>>
Returns Some
if self
is a mutable reference of variant YieldFrom
, and None
otherwise.
sourcepub fn expect_yield_from_expr(self) -> ExprYieldFrom<R>where
Self: Debug,
pub fn expect_yield_from_expr(self) -> ExprYieldFrom<R>where
Self: Debug,
sourcepub fn yield_from_expr(self) -> Option<ExprYieldFrom<R>>
pub fn yield_from_expr(self) -> Option<ExprYieldFrom<R>>
Returns Some
if self
is of variant YieldFrom
, and None
otherwise.
sourcepub const fn is_compare_expr(&self) -> bool
pub const fn is_compare_expr(&self) -> bool
Returns true
if self
is of variant Compare
.
sourcepub fn as_compare_expr(&self) -> Option<&ExprCompare<R>>
pub fn as_compare_expr(&self) -> Option<&ExprCompare<R>>
Returns Some
if self
is a reference of variant Compare
, and None
otherwise.
sourcepub fn as_mut_compare_expr(&mut self) -> Option<&mut ExprCompare<R>>
pub fn as_mut_compare_expr(&mut self) -> Option<&mut ExprCompare<R>>
Returns Some
if self
is a mutable reference of variant Compare
, and None
otherwise.
sourcepub fn expect_compare_expr(self) -> ExprCompare<R>where
Self: Debug,
pub fn expect_compare_expr(self) -> ExprCompare<R>where
Self: Debug,
sourcepub fn compare_expr(self) -> Option<ExprCompare<R>>
pub fn compare_expr(self) -> Option<ExprCompare<R>>
Returns Some
if self
is of variant Compare
, and None
otherwise.
sourcepub const fn is_call_expr(&self) -> bool
pub const fn is_call_expr(&self) -> bool
Returns true
if self
is of variant Call
.
sourcepub fn as_call_expr(&self) -> Option<&ExprCall<R>>
pub fn as_call_expr(&self) -> Option<&ExprCall<R>>
Returns Some
if self
is a reference of variant Call
, and None
otherwise.
sourcepub fn as_mut_call_expr(&mut self) -> Option<&mut ExprCall<R>>
pub fn as_mut_call_expr(&mut self) -> Option<&mut ExprCall<R>>
Returns Some
if self
is a mutable reference of variant Call
, and None
otherwise.
sourcepub fn expect_call_expr(self) -> ExprCall<R>where
Self: Debug,
pub fn expect_call_expr(self) -> ExprCall<R>where
Self: Debug,
sourcepub fn call_expr(self) -> Option<ExprCall<R>>
pub fn call_expr(self) -> Option<ExprCall<R>>
Returns Some
if self
is of variant Call
, and None
otherwise.
sourcepub const fn is_formatted_value_expr(&self) -> bool
pub const fn is_formatted_value_expr(&self) -> bool
Returns true
if self
is of variant FormattedValue
.
sourcepub fn as_formatted_value_expr(&self) -> Option<&ExprFormattedValue<R>>
pub fn as_formatted_value_expr(&self) -> Option<&ExprFormattedValue<R>>
Returns Some
if self
is a reference of variant FormattedValue
, and None
otherwise.
sourcepub fn as_mut_formatted_value_expr(
&mut self,
) -> Option<&mut ExprFormattedValue<R>>
pub fn as_mut_formatted_value_expr( &mut self, ) -> Option<&mut ExprFormattedValue<R>>
Returns Some
if self
is a mutable reference of variant FormattedValue
, and None
otherwise.
sourcepub fn expect_formatted_value_expr(self) -> ExprFormattedValue<R>where
Self: Debug,
pub fn expect_formatted_value_expr(self) -> ExprFormattedValue<R>where
Self: Debug,
Unwraps the value, yielding the content of FormattedValue
.
§Panics
Panics if the value is not FormattedValue
, with a panic message including the content of self
.
sourcepub fn formatted_value_expr(self) -> Option<ExprFormattedValue<R>>
pub fn formatted_value_expr(self) -> Option<ExprFormattedValue<R>>
Returns Some
if self
is of variant FormattedValue
, and None
otherwise.
sourcepub const fn is_joined_str_expr(&self) -> bool
pub const fn is_joined_str_expr(&self) -> bool
Returns true
if self
is of variant JoinedStr
.
sourcepub fn as_joined_str_expr(&self) -> Option<&ExprJoinedStr<R>>
pub fn as_joined_str_expr(&self) -> Option<&ExprJoinedStr<R>>
Returns Some
if self
is a reference of variant JoinedStr
, and None
otherwise.
sourcepub fn as_mut_joined_str_expr(&mut self) -> Option<&mut ExprJoinedStr<R>>
pub fn as_mut_joined_str_expr(&mut self) -> Option<&mut ExprJoinedStr<R>>
Returns Some
if self
is a mutable reference of variant JoinedStr
, and None
otherwise.
sourcepub fn expect_joined_str_expr(self) -> ExprJoinedStr<R>where
Self: Debug,
pub fn expect_joined_str_expr(self) -> ExprJoinedStr<R>where
Self: Debug,
sourcepub fn joined_str_expr(self) -> Option<ExprJoinedStr<R>>
pub fn joined_str_expr(self) -> Option<ExprJoinedStr<R>>
Returns Some
if self
is of variant JoinedStr
, and None
otherwise.
sourcepub const fn is_constant_expr(&self) -> bool
pub const fn is_constant_expr(&self) -> bool
Returns true
if self
is of variant Constant
.
sourcepub fn as_constant_expr(&self) -> Option<&ExprConstant<R>>
pub fn as_constant_expr(&self) -> Option<&ExprConstant<R>>
Returns Some
if self
is a reference of variant Constant
, and None
otherwise.
sourcepub fn as_mut_constant_expr(&mut self) -> Option<&mut ExprConstant<R>>
pub fn as_mut_constant_expr(&mut self) -> Option<&mut ExprConstant<R>>
Returns Some
if self
is a mutable reference of variant Constant
, and None
otherwise.
sourcepub fn expect_constant_expr(self) -> ExprConstant<R>where
Self: Debug,
pub fn expect_constant_expr(self) -> ExprConstant<R>where
Self: Debug,
sourcepub fn constant_expr(self) -> Option<ExprConstant<R>>
pub fn constant_expr(self) -> Option<ExprConstant<R>>
Returns Some
if self
is of variant Constant
, and None
otherwise.
sourcepub const fn is_attribute_expr(&self) -> bool
pub const fn is_attribute_expr(&self) -> bool
Returns true
if self
is of variant Attribute
.
sourcepub fn as_attribute_expr(&self) -> Option<&ExprAttribute<R>>
pub fn as_attribute_expr(&self) -> Option<&ExprAttribute<R>>
Returns Some
if self
is a reference of variant Attribute
, and None
otherwise.
sourcepub fn as_mut_attribute_expr(&mut self) -> Option<&mut ExprAttribute<R>>
pub fn as_mut_attribute_expr(&mut self) -> Option<&mut ExprAttribute<R>>
Returns Some
if self
is a mutable reference of variant Attribute
, and None
otherwise.
sourcepub fn expect_attribute_expr(self) -> ExprAttribute<R>where
Self: Debug,
pub fn expect_attribute_expr(self) -> ExprAttribute<R>where
Self: Debug,
sourcepub fn attribute_expr(self) -> Option<ExprAttribute<R>>
pub fn attribute_expr(self) -> Option<ExprAttribute<R>>
Returns Some
if self
is of variant Attribute
, and None
otherwise.
sourcepub const fn is_subscript_expr(&self) -> bool
pub const fn is_subscript_expr(&self) -> bool
Returns true
if self
is of variant Subscript
.
sourcepub fn as_subscript_expr(&self) -> Option<&ExprSubscript<R>>
pub fn as_subscript_expr(&self) -> Option<&ExprSubscript<R>>
Returns Some
if self
is a reference of variant Subscript
, and None
otherwise.
sourcepub fn as_mut_subscript_expr(&mut self) -> Option<&mut ExprSubscript<R>>
pub fn as_mut_subscript_expr(&mut self) -> Option<&mut ExprSubscript<R>>
Returns Some
if self
is a mutable reference of variant Subscript
, and None
otherwise.
sourcepub fn expect_subscript_expr(self) -> ExprSubscript<R>where
Self: Debug,
pub fn expect_subscript_expr(self) -> ExprSubscript<R>where
Self: Debug,
sourcepub fn subscript_expr(self) -> Option<ExprSubscript<R>>
pub fn subscript_expr(self) -> Option<ExprSubscript<R>>
Returns Some
if self
is of variant Subscript
, and None
otherwise.
sourcepub const fn is_starred_expr(&self) -> bool
pub const fn is_starred_expr(&self) -> bool
Returns true
if self
is of variant Starred
.
sourcepub fn as_starred_expr(&self) -> Option<&ExprStarred<R>>
pub fn as_starred_expr(&self) -> Option<&ExprStarred<R>>
Returns Some
if self
is a reference of variant Starred
, and None
otherwise.
sourcepub fn as_mut_starred_expr(&mut self) -> Option<&mut ExprStarred<R>>
pub fn as_mut_starred_expr(&mut self) -> Option<&mut ExprStarred<R>>
Returns Some
if self
is a mutable reference of variant Starred
, and None
otherwise.
sourcepub fn expect_starred_expr(self) -> ExprStarred<R>where
Self: Debug,
pub fn expect_starred_expr(self) -> ExprStarred<R>where
Self: Debug,
sourcepub fn starred_expr(self) -> Option<ExprStarred<R>>
pub fn starred_expr(self) -> Option<ExprStarred<R>>
Returns Some
if self
is of variant Starred
, and None
otherwise.
sourcepub const fn is_name_expr(&self) -> bool
pub const fn is_name_expr(&self) -> bool
Returns true
if self
is of variant Name
.
sourcepub fn as_name_expr(&self) -> Option<&ExprName<R>>
pub fn as_name_expr(&self) -> Option<&ExprName<R>>
Returns Some
if self
is a reference of variant Name
, and None
otherwise.
sourcepub fn as_mut_name_expr(&mut self) -> Option<&mut ExprName<R>>
pub fn as_mut_name_expr(&mut self) -> Option<&mut ExprName<R>>
Returns Some
if self
is a mutable reference of variant Name
, and None
otherwise.
sourcepub fn expect_name_expr(self) -> ExprName<R>where
Self: Debug,
pub fn expect_name_expr(self) -> ExprName<R>where
Self: Debug,
sourcepub fn name_expr(self) -> Option<ExprName<R>>
pub fn name_expr(self) -> Option<ExprName<R>>
Returns Some
if self
is of variant Name
, and None
otherwise.
sourcepub const fn is_list_expr(&self) -> bool
pub const fn is_list_expr(&self) -> bool
Returns true
if self
is of variant List
.
sourcepub fn as_list_expr(&self) -> Option<&ExprList<R>>
pub fn as_list_expr(&self) -> Option<&ExprList<R>>
Returns Some
if self
is a reference of variant List
, and None
otherwise.
sourcepub fn as_mut_list_expr(&mut self) -> Option<&mut ExprList<R>>
pub fn as_mut_list_expr(&mut self) -> Option<&mut ExprList<R>>
Returns Some
if self
is a mutable reference of variant List
, and None
otherwise.
sourcepub fn expect_list_expr(self) -> ExprList<R>where
Self: Debug,
pub fn expect_list_expr(self) -> ExprList<R>where
Self: Debug,
sourcepub fn list_expr(self) -> Option<ExprList<R>>
pub fn list_expr(self) -> Option<ExprList<R>>
Returns Some
if self
is of variant List
, and None
otherwise.
sourcepub const fn is_tuple_expr(&self) -> bool
pub const fn is_tuple_expr(&self) -> bool
Returns true
if self
is of variant Tuple
.
sourcepub fn as_tuple_expr(&self) -> Option<&ExprTuple<R>>
pub fn as_tuple_expr(&self) -> Option<&ExprTuple<R>>
Returns Some
if self
is a reference of variant Tuple
, and None
otherwise.
sourcepub fn as_mut_tuple_expr(&mut self) -> Option<&mut ExprTuple<R>>
pub fn as_mut_tuple_expr(&mut self) -> Option<&mut ExprTuple<R>>
Returns Some
if self
is a mutable reference of variant Tuple
, and None
otherwise.
sourcepub fn expect_tuple_expr(self) -> ExprTuple<R>where
Self: Debug,
pub fn expect_tuple_expr(self) -> ExprTuple<R>where
Self: Debug,
sourcepub fn tuple_expr(self) -> Option<ExprTuple<R>>
pub fn tuple_expr(self) -> Option<ExprTuple<R>>
Returns Some
if self
is of variant Tuple
, and None
otherwise.
sourcepub const fn is_slice_expr(&self) -> bool
pub const fn is_slice_expr(&self) -> bool
Returns true
if self
is of variant Slice
.
sourcepub fn as_slice_expr(&self) -> Option<&ExprSlice<R>>
pub fn as_slice_expr(&self) -> Option<&ExprSlice<R>>
Returns Some
if self
is a reference of variant Slice
, and None
otherwise.
sourcepub fn as_mut_slice_expr(&mut self) -> Option<&mut ExprSlice<R>>
pub fn as_mut_slice_expr(&mut self) -> Option<&mut ExprSlice<R>>
Returns Some
if self
is a mutable reference of variant Slice
, and None
otherwise.
sourcepub fn expect_slice_expr(self) -> ExprSlice<R>where
Self: Debug,
pub fn expect_slice_expr(self) -> ExprSlice<R>where
Self: Debug,
sourcepub fn slice_expr(self) -> Option<ExprSlice<R>>
pub fn slice_expr(self) -> Option<ExprSlice<R>>
Returns Some
if self
is of variant Slice
, and None
otherwise.
Trait Implementations§
source§impl<R> From<ExprAttribute<R>> for Expr<R>
impl<R> From<ExprAttribute<R>> for Expr<R>
source§fn from(payload: ExprAttribute<R>) -> Self
fn from(payload: ExprAttribute<R>) -> Self
source§impl<R> From<ExprBoolOp<R>> for Expr<R>
impl<R> From<ExprBoolOp<R>> for Expr<R>
source§fn from(payload: ExprBoolOp<R>) -> Self
fn from(payload: ExprBoolOp<R>) -> Self
source§impl<R> From<ExprCompare<R>> for Expr<R>
impl<R> From<ExprCompare<R>> for Expr<R>
source§fn from(payload: ExprCompare<R>) -> Self
fn from(payload: ExprCompare<R>) -> Self
source§impl<R> From<ExprConstant<R>> for Expr<R>
impl<R> From<ExprConstant<R>> for Expr<R>
source§fn from(payload: ExprConstant<R>) -> Self
fn from(payload: ExprConstant<R>) -> Self
source§impl<R> From<ExprDictComp<R>> for Expr<R>
impl<R> From<ExprDictComp<R>> for Expr<R>
source§fn from(payload: ExprDictComp<R>) -> Self
fn from(payload: ExprDictComp<R>) -> Self
source§impl<R> From<ExprFormattedValue<R>> for Expr<R>
impl<R> From<ExprFormattedValue<R>> for Expr<R>
source§fn from(payload: ExprFormattedValue<R>) -> Self
fn from(payload: ExprFormattedValue<R>) -> Self
source§impl<R> From<ExprGeneratorExp<R>> for Expr<R>
impl<R> From<ExprGeneratorExp<R>> for Expr<R>
source§fn from(payload: ExprGeneratorExp<R>) -> Self
fn from(payload: ExprGeneratorExp<R>) -> Self
source§impl<R> From<ExprJoinedStr<R>> for Expr<R>
impl<R> From<ExprJoinedStr<R>> for Expr<R>
source§fn from(payload: ExprJoinedStr<R>) -> Self
fn from(payload: ExprJoinedStr<R>) -> Self
source§impl<R> From<ExprLambda<R>> for Expr<R>
impl<R> From<ExprLambda<R>> for Expr<R>
source§fn from(payload: ExprLambda<R>) -> Self
fn from(payload: ExprLambda<R>) -> Self
source§impl<R> From<ExprListComp<R>> for Expr<R>
impl<R> From<ExprListComp<R>> for Expr<R>
source§fn from(payload: ExprListComp<R>) -> Self
fn from(payload: ExprListComp<R>) -> Self
source§impl<R> From<ExprNamedExpr<R>> for Expr<R>
impl<R> From<ExprNamedExpr<R>> for Expr<R>
source§fn from(payload: ExprNamedExpr<R>) -> Self
fn from(payload: ExprNamedExpr<R>) -> Self
source§impl<R> From<ExprSetComp<R>> for Expr<R>
impl<R> From<ExprSetComp<R>> for Expr<R>
source§fn from(payload: ExprSetComp<R>) -> Self
fn from(payload: ExprSetComp<R>) -> Self
source§impl<R> From<ExprStarred<R>> for Expr<R>
impl<R> From<ExprStarred<R>> for Expr<R>
source§fn from(payload: ExprStarred<R>) -> Self
fn from(payload: ExprStarred<R>) -> Self
source§impl<R> From<ExprSubscript<R>> for Expr<R>
impl<R> From<ExprSubscript<R>> for Expr<R>
source§fn from(payload: ExprSubscript<R>) -> Self
fn from(payload: ExprSubscript<R>) -> Self
source§impl<R> From<ExprUnaryOp<R>> for Expr<R>
impl<R> From<ExprUnaryOp<R>> for Expr<R>
source§fn from(payload: ExprUnaryOp<R>) -> Self
fn from(payload: ExprUnaryOp<R>) -> Self
source§impl<R> From<ExprYieldFrom<R>> for Expr<R>
impl<R> From<ExprYieldFrom<R>> for Expr<R>
source§fn from(payload: ExprYieldFrom<R>) -> Self
fn from(payload: ExprYieldFrom<R>) -> Self
impl<R> StructuralPartialEq for Expr<R>
Auto Trait Implementations§
impl<R> Freeze for Expr<R>where
R: Freeze,
impl<R> RefUnwindSafe for Expr<R>where
R: RefUnwindSafe,
impl<R> Send for Expr<R>where
R: Send,
impl<R> Sync for Expr<R>where
R: Sync,
impl<R> Unpin for Expr<R>where
R: Unpin,
impl<R> UnwindSafe for Expr<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