pub enum Expr {
Show 33 variants
BoolOp(ExprBoolOp),
Named(ExprNamed),
BinOp(ExprBinOp),
UnaryOp(ExprUnaryOp),
Lambda(ExprLambda),
If(ExprIf),
Dict(ExprDict),
Set(ExprSet),
ListComp(ExprListComp),
SetComp(ExprSetComp),
DictComp(ExprDictComp),
Generator(ExprGenerator),
Await(ExprAwait),
Yield(ExprYield),
YieldFrom(ExprYieldFrom),
Compare(ExprCompare),
Call(ExprCall),
FString(ExprFString),
TString(ExprTString),
StringLiteral(ExprStringLiteral),
BytesLiteral(ExprBytesLiteral),
NumberLiteral(ExprNumberLiteral),
BooleanLiteral(ExprBooleanLiteral),
NoneLiteral(ExprNoneLiteral),
EllipsisLiteral(ExprEllipsisLiteral),
Attribute(ExprAttribute),
Subscript(ExprSubscript),
Starred(ExprStarred),
Name(ExprName),
List(ExprList),
Tuple(ExprTuple),
Slice(ExprSlice),
IpyEscapeCommand(ExprIpyEscapeCommand),
}Expand description
See also expr
Variants§
BoolOp(ExprBoolOp)
Named(ExprNamed)
BinOp(ExprBinOp)
UnaryOp(ExprUnaryOp)
Lambda(ExprLambda)
If(ExprIf)
Dict(ExprDict)
Set(ExprSet)
ListComp(ExprListComp)
SetComp(ExprSetComp)
DictComp(ExprDictComp)
Generator(ExprGenerator)
Await(ExprAwait)
Yield(ExprYield)
YieldFrom(ExprYieldFrom)
Compare(ExprCompare)
Call(ExprCall)
FString(ExprFString)
TString(ExprTString)
StringLiteral(ExprStringLiteral)
BytesLiteral(ExprBytesLiteral)
NumberLiteral(ExprNumberLiteral)
BooleanLiteral(ExprBooleanLiteral)
NoneLiteral(ExprNoneLiteral)
EllipsisLiteral(ExprEllipsisLiteral)
Attribute(ExprAttribute)
Subscript(ExprSubscript)
Starred(ExprStarred)
Name(ExprName)
List(ExprList)
Tuple(ExprTuple)
Slice(ExprSlice)
IpyEscapeCommand(ExprIpyEscapeCommand)
Implementations§
Source§impl Expr
impl Expr
pub const fn is_bool_op_expr(&self) -> bool
pub fn bool_op_expr(self) -> Option<ExprBoolOp>
pub fn expect_bool_op_expr(self) -> ExprBoolOp
pub fn as_bool_op_expr_mut(&mut self) -> Option<&mut ExprBoolOp>
pub fn as_bool_op_expr(&self) -> Option<&ExprBoolOp>
pub const fn is_named_expr(&self) -> bool
pub fn named_expr(self) -> Option<ExprNamed>
pub fn expect_named_expr(self) -> ExprNamed
pub fn as_named_expr_mut(&mut self) -> Option<&mut ExprNamed>
pub fn as_named_expr(&self) -> Option<&ExprNamed>
pub const fn is_bin_op_expr(&self) -> bool
pub fn bin_op_expr(self) -> Option<ExprBinOp>
pub fn expect_bin_op_expr(self) -> ExprBinOp
pub fn as_bin_op_expr_mut(&mut self) -> Option<&mut ExprBinOp>
pub fn as_bin_op_expr(&self) -> Option<&ExprBinOp>
pub const fn is_unary_op_expr(&self) -> bool
pub fn unary_op_expr(self) -> Option<ExprUnaryOp>
pub fn expect_unary_op_expr(self) -> ExprUnaryOp
pub fn as_unary_op_expr_mut(&mut self) -> Option<&mut ExprUnaryOp>
pub fn as_unary_op_expr(&self) -> Option<&ExprUnaryOp>
pub const fn is_lambda_expr(&self) -> bool
pub fn lambda_expr(self) -> Option<ExprLambda>
pub fn expect_lambda_expr(self) -> ExprLambda
pub fn as_lambda_expr_mut(&mut self) -> Option<&mut ExprLambda>
pub fn as_lambda_expr(&self) -> Option<&ExprLambda>
pub const fn is_if_expr(&self) -> bool
pub fn if_expr(self) -> Option<ExprIf>
pub fn expect_if_expr(self) -> ExprIf
pub fn as_if_expr_mut(&mut self) -> Option<&mut ExprIf>
pub fn as_if_expr(&self) -> Option<&ExprIf>
pub const fn is_dict_expr(&self) -> bool
pub fn dict_expr(self) -> Option<ExprDict>
pub fn expect_dict_expr(self) -> ExprDict
pub fn as_dict_expr_mut(&mut self) -> Option<&mut ExprDict>
pub fn as_dict_expr(&self) -> Option<&ExprDict>
pub const fn is_set_expr(&self) -> bool
pub fn set_expr(self) -> Option<ExprSet>
pub fn expect_set_expr(self) -> ExprSet
pub fn as_set_expr_mut(&mut self) -> Option<&mut ExprSet>
pub fn as_set_expr(&self) -> Option<&ExprSet>
pub const fn is_list_comp_expr(&self) -> bool
pub fn list_comp_expr(self) -> Option<ExprListComp>
pub fn expect_list_comp_expr(self) -> ExprListComp
pub fn as_list_comp_expr_mut(&mut self) -> Option<&mut ExprListComp>
pub fn as_list_comp_expr(&self) -> Option<&ExprListComp>
pub const fn is_set_comp_expr(&self) -> bool
pub fn set_comp_expr(self) -> Option<ExprSetComp>
pub fn expect_set_comp_expr(self) -> ExprSetComp
pub fn as_set_comp_expr_mut(&mut self) -> Option<&mut ExprSetComp>
pub fn as_set_comp_expr(&self) -> Option<&ExprSetComp>
pub const fn is_dict_comp_expr(&self) -> bool
pub fn dict_comp_expr(self) -> Option<ExprDictComp>
pub fn expect_dict_comp_expr(self) -> ExprDictComp
pub fn as_dict_comp_expr_mut(&mut self) -> Option<&mut ExprDictComp>
pub fn as_dict_comp_expr(&self) -> Option<&ExprDictComp>
pub const fn is_generator_expr(&self) -> bool
pub fn generator_expr(self) -> Option<ExprGenerator>
pub fn expect_generator_expr(self) -> ExprGenerator
pub fn as_generator_expr_mut(&mut self) -> Option<&mut ExprGenerator>
pub fn as_generator_expr(&self) -> Option<&ExprGenerator>
pub const fn is_await_expr(&self) -> bool
pub fn await_expr(self) -> Option<ExprAwait>
pub fn expect_await_expr(self) -> ExprAwait
pub fn as_await_expr_mut(&mut self) -> Option<&mut ExprAwait>
pub fn as_await_expr(&self) -> Option<&ExprAwait>
pub const fn is_yield_expr(&self) -> bool
pub fn yield_expr(self) -> Option<ExprYield>
pub fn expect_yield_expr(self) -> ExprYield
pub fn as_yield_expr_mut(&mut self) -> Option<&mut ExprYield>
pub fn as_yield_expr(&self) -> Option<&ExprYield>
pub const fn is_yield_from_expr(&self) -> bool
pub fn yield_from_expr(self) -> Option<ExprYieldFrom>
pub fn expect_yield_from_expr(self) -> ExprYieldFrom
pub fn as_yield_from_expr_mut(&mut self) -> Option<&mut ExprYieldFrom>
pub fn as_yield_from_expr(&self) -> Option<&ExprYieldFrom>
pub const fn is_compare_expr(&self) -> bool
pub fn compare_expr(self) -> Option<ExprCompare>
pub fn expect_compare_expr(self) -> ExprCompare
pub fn as_compare_expr_mut(&mut self) -> Option<&mut ExprCompare>
pub fn as_compare_expr(&self) -> Option<&ExprCompare>
pub const fn is_call_expr(&self) -> bool
pub fn call_expr(self) -> Option<ExprCall>
pub fn expect_call_expr(self) -> ExprCall
pub fn as_call_expr_mut(&mut self) -> Option<&mut ExprCall>
pub fn as_call_expr(&self) -> Option<&ExprCall>
pub const fn is_f_string_expr(&self) -> bool
pub fn f_string_expr(self) -> Option<ExprFString>
pub fn expect_f_string_expr(self) -> ExprFString
pub fn as_f_string_expr_mut(&mut self) -> Option<&mut ExprFString>
pub fn as_f_string_expr(&self) -> Option<&ExprFString>
pub const fn is_t_string_expr(&self) -> bool
pub fn t_string_expr(self) -> Option<ExprTString>
pub fn expect_t_string_expr(self) -> ExprTString
pub fn as_t_string_expr_mut(&mut self) -> Option<&mut ExprTString>
pub fn as_t_string_expr(&self) -> Option<&ExprTString>
pub const fn is_string_literal_expr(&self) -> bool
pub fn string_literal_expr(self) -> Option<ExprStringLiteral>
pub fn expect_string_literal_expr(self) -> ExprStringLiteral
pub fn as_string_literal_expr_mut(&mut self) -> Option<&mut ExprStringLiteral>
pub fn as_string_literal_expr(&self) -> Option<&ExprStringLiteral>
pub const fn is_bytes_literal_expr(&self) -> bool
pub fn bytes_literal_expr(self) -> Option<ExprBytesLiteral>
pub fn expect_bytes_literal_expr(self) -> ExprBytesLiteral
pub fn as_bytes_literal_expr_mut(&mut self) -> Option<&mut ExprBytesLiteral>
pub fn as_bytes_literal_expr(&self) -> Option<&ExprBytesLiteral>
pub const fn is_number_literal_expr(&self) -> bool
pub fn number_literal_expr(self) -> Option<ExprNumberLiteral>
pub fn expect_number_literal_expr(self) -> ExprNumberLiteral
pub fn as_number_literal_expr_mut(&mut self) -> Option<&mut ExprNumberLiteral>
pub fn as_number_literal_expr(&self) -> Option<&ExprNumberLiteral>
pub const fn is_boolean_literal_expr(&self) -> bool
pub fn boolean_literal_expr(self) -> Option<ExprBooleanLiteral>
pub fn expect_boolean_literal_expr(self) -> ExprBooleanLiteral
pub fn as_boolean_literal_expr_mut(&mut self) -> Option<&mut ExprBooleanLiteral>
pub fn as_boolean_literal_expr(&self) -> Option<&ExprBooleanLiteral>
pub const fn is_none_literal_expr(&self) -> bool
pub fn none_literal_expr(self) -> Option<ExprNoneLiteral>
pub fn expect_none_literal_expr(self) -> ExprNoneLiteral
pub fn as_none_literal_expr_mut(&mut self) -> Option<&mut ExprNoneLiteral>
pub fn as_none_literal_expr(&self) -> Option<&ExprNoneLiteral>
pub const fn is_ellipsis_literal_expr(&self) -> bool
pub fn ellipsis_literal_expr(self) -> Option<ExprEllipsisLiteral>
pub fn expect_ellipsis_literal_expr(self) -> ExprEllipsisLiteral
pub fn as_ellipsis_literal_expr_mut( &mut self, ) -> Option<&mut ExprEllipsisLiteral>
pub fn as_ellipsis_literal_expr(&self) -> Option<&ExprEllipsisLiteral>
pub const fn is_attribute_expr(&self) -> bool
pub fn attribute_expr(self) -> Option<ExprAttribute>
pub fn expect_attribute_expr(self) -> ExprAttribute
pub fn as_attribute_expr_mut(&mut self) -> Option<&mut ExprAttribute>
pub fn as_attribute_expr(&self) -> Option<&ExprAttribute>
pub const fn is_subscript_expr(&self) -> bool
pub fn subscript_expr(self) -> Option<ExprSubscript>
pub fn expect_subscript_expr(self) -> ExprSubscript
pub fn as_subscript_expr_mut(&mut self) -> Option<&mut ExprSubscript>
pub fn as_subscript_expr(&self) -> Option<&ExprSubscript>
pub const fn is_starred_expr(&self) -> bool
pub fn starred_expr(self) -> Option<ExprStarred>
pub fn expect_starred_expr(self) -> ExprStarred
pub fn as_starred_expr_mut(&mut self) -> Option<&mut ExprStarred>
pub fn as_starred_expr(&self) -> Option<&ExprStarred>
pub const fn is_name_expr(&self) -> bool
pub fn name_expr(self) -> Option<ExprName>
pub fn expect_name_expr(self) -> ExprName
pub fn as_name_expr_mut(&mut self) -> Option<&mut ExprName>
pub fn as_name_expr(&self) -> Option<&ExprName>
pub const fn is_list_expr(&self) -> bool
pub fn list_expr(self) -> Option<ExprList>
pub fn expect_list_expr(self) -> ExprList
pub fn as_list_expr_mut(&mut self) -> Option<&mut ExprList>
pub fn as_list_expr(&self) -> Option<&ExprList>
pub const fn is_tuple_expr(&self) -> bool
pub fn tuple_expr(self) -> Option<ExprTuple>
pub fn expect_tuple_expr(self) -> ExprTuple
pub fn as_tuple_expr_mut(&mut self) -> Option<&mut ExprTuple>
pub fn as_tuple_expr(&self) -> Option<&ExprTuple>
pub const fn is_slice_expr(&self) -> bool
pub fn slice_expr(self) -> Option<ExprSlice>
pub fn expect_slice_expr(self) -> ExprSlice
pub fn as_slice_expr_mut(&mut self) -> Option<&mut ExprSlice>
pub fn as_slice_expr(&self) -> Option<&ExprSlice>
pub const fn is_ipy_escape_command_expr(&self) -> bool
pub fn ipy_escape_command_expr(self) -> Option<ExprIpyEscapeCommand>
pub fn expect_ipy_escape_command_expr(self) -> ExprIpyEscapeCommand
pub fn as_ipy_escape_command_expr_mut( &mut self, ) -> Option<&mut ExprIpyEscapeCommand>
pub fn as_ipy_escape_command_expr(&self) -> Option<&ExprIpyEscapeCommand>
Source§impl Expr
impl Expr
Sourcepub fn is_literal_expr(&self) -> bool
pub fn is_literal_expr(&self) -> bool
Returns true if the expression is a literal expression.
A literal expression is either a string literal, bytes literal,
integer, float, complex number, boolean, None, or ellipsis (...).
Sourcepub fn as_literal_expr(&self) -> Option<LiteralExpressionRef<'_>>
pub fn as_literal_expr(&self) -> Option<LiteralExpressionRef<'_>>
Returns LiteralExpressionRef if the expression is a literal expression.
Sourcepub fn precedence(&self) -> OperatorPrecedence
pub fn precedence(&self) -> OperatorPrecedence
Return the OperatorPrecedence of this expression
Trait Implementations§
Source§impl<'a> From<&'a Expr> for AnyNodeRef<'a>
impl<'a> From<&'a Expr> for AnyNodeRef<'a>
Source§fn from(node: &'a Expr) -> AnyNodeRef<'a>
fn from(node: &'a Expr) -> AnyNodeRef<'a>
Converts to this type from the input type.
Source§impl<'a> From<&'a Expr> for AnyRootNodeRef<'a>
impl<'a> From<&'a Expr> for AnyRootNodeRef<'a>
Source§fn from(node: &'a Expr) -> AnyRootNodeRef<'a>
fn from(node: &'a Expr) -> AnyRootNodeRef<'a>
Converts to this type from the input type.
Source§impl<'a> From<&'a Expr> for ArgOrKeyword<'a>
impl<'a> From<&'a Expr> for ArgOrKeyword<'a>
Source§impl<'a> From<&'a Expr> for ComparableExpr<'a>
impl<'a> From<&'a Expr> for ComparableExpr<'a>
Source§impl<'a> From<&'a Expr> for HashableExpr<'a>
impl<'a> From<&'a Expr> for HashableExpr<'a>
Source§impl From<&Expr> for OperatorPrecedence
impl From<&Expr> for OperatorPrecedence
Source§impl From<BytesLiteral> for Expr
impl From<BytesLiteral> for Expr
Source§fn from(payload: BytesLiteral) -> Self
fn from(payload: BytesLiteral) -> Self
Converts to this type from the input type.
Source§impl From<ExprAttribute> for Expr
impl From<ExprAttribute> for Expr
Source§fn from(node: ExprAttribute) -> Self
fn from(node: ExprAttribute) -> Self
Converts to this type from the input type.
Source§impl From<ExprBoolOp> for Expr
impl From<ExprBoolOp> for Expr
Source§fn from(node: ExprBoolOp) -> Self
fn from(node: ExprBoolOp) -> Self
Converts to this type from the input type.
Source§impl From<ExprBooleanLiteral> for Expr
impl From<ExprBooleanLiteral> for Expr
Source§fn from(node: ExprBooleanLiteral) -> Self
fn from(node: ExprBooleanLiteral) -> Self
Converts to this type from the input type.
Source§impl From<ExprBytesLiteral> for Expr
impl From<ExprBytesLiteral> for Expr
Source§fn from(node: ExprBytesLiteral) -> Self
fn from(node: ExprBytesLiteral) -> Self
Converts to this type from the input type.
Source§impl From<ExprCompare> for Expr
impl From<ExprCompare> for Expr
Source§fn from(node: ExprCompare) -> Self
fn from(node: ExprCompare) -> Self
Converts to this type from the input type.
Source§impl From<ExprDictComp> for Expr
impl From<ExprDictComp> for Expr
Source§fn from(node: ExprDictComp) -> Self
fn from(node: ExprDictComp) -> Self
Converts to this type from the input type.
Source§impl From<ExprEllipsisLiteral> for Expr
impl From<ExprEllipsisLiteral> for Expr
Source§fn from(node: ExprEllipsisLiteral) -> Self
fn from(node: ExprEllipsisLiteral) -> Self
Converts to this type from the input type.
Source§impl From<ExprFString> for Expr
impl From<ExprFString> for Expr
Source§fn from(node: ExprFString) -> Self
fn from(node: ExprFString) -> Self
Converts to this type from the input type.
Source§impl From<ExprGenerator> for Expr
impl From<ExprGenerator> for Expr
Source§fn from(node: ExprGenerator) -> Self
fn from(node: ExprGenerator) -> Self
Converts to this type from the input type.
Source§impl From<ExprIpyEscapeCommand> for Expr
impl From<ExprIpyEscapeCommand> for Expr
Source§fn from(node: ExprIpyEscapeCommand) -> Self
fn from(node: ExprIpyEscapeCommand) -> Self
Converts to this type from the input type.
Source§impl From<ExprLambda> for Expr
impl From<ExprLambda> for Expr
Source§fn from(node: ExprLambda) -> Self
fn from(node: ExprLambda) -> Self
Converts to this type from the input type.
Source§impl From<ExprListComp> for Expr
impl From<ExprListComp> for Expr
Source§fn from(node: ExprListComp) -> Self
fn from(node: ExprListComp) -> Self
Converts to this type from the input type.
Source§impl From<ExprNoneLiteral> for Expr
impl From<ExprNoneLiteral> for Expr
Source§fn from(node: ExprNoneLiteral) -> Self
fn from(node: ExprNoneLiteral) -> Self
Converts to this type from the input type.
Source§impl From<ExprNumberLiteral> for Expr
impl From<ExprNumberLiteral> for Expr
Source§fn from(node: ExprNumberLiteral) -> Self
fn from(node: ExprNumberLiteral) -> Self
Converts to this type from the input type.
Source§impl From<ExprSetComp> for Expr
impl From<ExprSetComp> for Expr
Source§fn from(node: ExprSetComp) -> Self
fn from(node: ExprSetComp) -> Self
Converts to this type from the input type.
Source§impl From<ExprStarred> for Expr
impl From<ExprStarred> for Expr
Source§fn from(node: ExprStarred) -> Self
fn from(node: ExprStarred) -> Self
Converts to this type from the input type.
Source§impl From<ExprStringLiteral> for Expr
impl From<ExprStringLiteral> for Expr
Source§fn from(node: ExprStringLiteral) -> Self
fn from(node: ExprStringLiteral) -> Self
Converts to this type from the input type.
Source§impl From<ExprSubscript> for Expr
impl From<ExprSubscript> for Expr
Source§fn from(node: ExprSubscript) -> Self
fn from(node: ExprSubscript) -> Self
Converts to this type from the input type.
Source§impl From<ExprTString> for Expr
impl From<ExprTString> for Expr
Source§fn from(node: ExprTString) -> Self
fn from(node: ExprTString) -> Self
Converts to this type from the input type.
Source§impl From<ExprUnaryOp> for Expr
impl From<ExprUnaryOp> for Expr
Source§fn from(node: ExprUnaryOp) -> Self
fn from(node: ExprUnaryOp) -> Self
Converts to this type from the input type.
Source§impl From<ExprYieldFrom> for Expr
impl From<ExprYieldFrom> for Expr
Source§fn from(node: ExprYieldFrom) -> Self
fn from(node: ExprYieldFrom) -> Self
Converts to this type from the input type.
Source§impl From<StringLiteral> for Expr
impl From<StringLiteral> for Expr
Source§fn from(payload: StringLiteral) -> Self
fn from(payload: StringLiteral) -> Self
Converts to this type from the input type.
Source§impl HasNodeIndex for Expr
impl HasNodeIndex for Expr
Source§fn node_index(&self) -> &AtomicNodeIndex
fn node_index(&self) -> &AtomicNodeIndex
Returns the
AtomicNodeIndex for this node.Source§impl<'a> TryFrom<&'a Expr> for StringLike<'a>
impl<'a> TryFrom<&'a Expr> for StringLike<'a>
Source§impl<'a> TryFrom<AnyRootNodeRef<'a>> for &'a Expr
impl<'a> TryFrom<AnyRootNodeRef<'a>> for &'a Expr
impl StructuralPartialEq for Expr
Auto Trait Implementations§
impl !Freeze for Expr
impl RefUnwindSafe for Expr
impl Send for Expr
impl Sync for Expr
impl Unpin for Expr
impl UnsafeUnpin for Expr
impl UnwindSafe for Expr
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
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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 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>
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