Enum prql_compiler::ast::rq::ExprKind
source · pub enum ExprKind {
ColumnRef(CId),
Literal(Literal),
Binary {
left: Box<Expr>,
op: BinOp,
right: Box<Expr>,
},
Unary {
op: UnOp,
expr: Box<Expr>,
},
SString(Vec<InterpolateItem<Expr>>),
FString(Vec<InterpolateItem<Expr>>),
Switch(Vec<SwitchCase<Expr>>),
BuiltInFunction {
name: String,
args: Vec<Expr>,
},
}
Variants§
ColumnRef(CId)
Literal(Literal)
Binary
Unary
SString(Vec<InterpolateItem<Expr>>)
FString(Vec<InterpolateItem<Expr>>)
Switch(Vec<SwitchCase<Expr>>)
BuiltInFunction
Implementations§
source§impl ExprKind
impl ExprKind
sourcepub fn as_column_ref_mut(&mut self) -> Option<&mut CId>
pub fn as_column_ref_mut(&mut self) -> Option<&mut CId>
Optionally returns mutable references to the inner fields if this is a ExprKind::ColumnRef
, otherwise None
sourcepub fn as_column_ref(&self) -> Option<&CId>
pub fn as_column_ref(&self) -> Option<&CId>
Optionally returns references to the inner fields if this is a ExprKind::ColumnRef
, otherwise None
sourcepub fn into_column_ref(self) -> Result<CId, Self>
pub fn into_column_ref(self) -> Result<CId, Self>
Returns the inner fields if this is a ExprKind::ColumnRef
, otherwise returns back the enum in the Err
case of the result
sourcepub fn as_literal_mut(&mut self) -> Option<&mut Literal>
pub fn as_literal_mut(&mut self) -> Option<&mut Literal>
Optionally returns mutable references to the inner fields if this is a ExprKind::Literal
, otherwise None
sourcepub fn as_literal(&self) -> Option<&Literal>
pub fn as_literal(&self) -> Option<&Literal>
Optionally returns references to the inner fields if this is a ExprKind::Literal
, otherwise None
sourcepub fn into_literal(self) -> Result<Literal, Self>
pub fn into_literal(self) -> Result<Literal, Self>
Returns the inner fields if this is a ExprKind::Literal
, otherwise returns back the enum in the Err
case of the result
sourcepub fn as_binary_mut(
&mut self
) -> Option<(&mut Box<Expr>, &mut BinOp, &mut Box<Expr>)>
pub fn as_binary_mut(
&mut self
) -> Option<(&mut Box<Expr>, &mut BinOp, &mut Box<Expr>)>
Optionally returns mutable references to the inner fields if this is a ExprKind::Binary
, otherwise None
sourcepub fn as_binary(&self) -> Option<(&Box<Expr>, &BinOp, &Box<Expr>)>
pub fn as_binary(&self) -> Option<(&Box<Expr>, &BinOp, &Box<Expr>)>
Optionally returns references to the inner fields if this is a ExprKind::Binary
, otherwise None
sourcepub fn into_binary(self) -> Result<(Box<Expr>, BinOp, Box<Expr>), Self>
pub fn into_binary(self) -> Result<(Box<Expr>, BinOp, Box<Expr>), Self>
Returns the inner fields if this is a ExprKind::Binary
, otherwise returns back the enum in the Err
case of the result
sourcepub fn as_unary_mut(&mut self) -> Option<(&mut UnOp, &mut Box<Expr>)>
pub fn as_unary_mut(&mut self) -> Option<(&mut UnOp, &mut Box<Expr>)>
Optionally returns mutable references to the inner fields if this is a ExprKind::Unary
, otherwise None
sourcepub fn as_unary(&self) -> Option<(&UnOp, &Box<Expr>)>
pub fn as_unary(&self) -> Option<(&UnOp, &Box<Expr>)>
Optionally returns references to the inner fields if this is a ExprKind::Unary
, otherwise None
sourcepub fn into_unary(self) -> Result<(UnOp, Box<Expr>), Self>
pub fn into_unary(self) -> Result<(UnOp, Box<Expr>), Self>
Returns the inner fields if this is a ExprKind::Unary
, otherwise returns back the enum in the Err
case of the result
sourcepub fn as_s_string_mut(&mut self) -> Option<&mut Vec<InterpolateItem<Expr>>>
pub fn as_s_string_mut(&mut self) -> Option<&mut Vec<InterpolateItem<Expr>>>
Optionally returns mutable references to the inner fields if this is a ExprKind::SString
, otherwise None
sourcepub fn as_s_string(&self) -> Option<&Vec<InterpolateItem<Expr>>>
pub fn as_s_string(&self) -> Option<&Vec<InterpolateItem<Expr>>>
Optionally returns references to the inner fields if this is a ExprKind::SString
, otherwise None
sourcepub fn into_s_string(self) -> Result<Vec<InterpolateItem<Expr>>, Self>
pub fn into_s_string(self) -> Result<Vec<InterpolateItem<Expr>>, Self>
Returns the inner fields if this is a ExprKind::SString
, otherwise returns back the enum in the Err
case of the result
sourcepub fn as_f_string_mut(&mut self) -> Option<&mut Vec<InterpolateItem<Expr>>>
pub fn as_f_string_mut(&mut self) -> Option<&mut Vec<InterpolateItem<Expr>>>
Optionally returns mutable references to the inner fields if this is a ExprKind::FString
, otherwise None
sourcepub fn as_f_string(&self) -> Option<&Vec<InterpolateItem<Expr>>>
pub fn as_f_string(&self) -> Option<&Vec<InterpolateItem<Expr>>>
Optionally returns references to the inner fields if this is a ExprKind::FString
, otherwise None
sourcepub fn into_f_string(self) -> Result<Vec<InterpolateItem<Expr>>, Self>
pub fn into_f_string(self) -> Result<Vec<InterpolateItem<Expr>>, Self>
Returns the inner fields if this is a ExprKind::FString
, otherwise returns back the enum in the Err
case of the result
sourcepub fn as_switch_mut(&mut self) -> Option<&mut Vec<SwitchCase<Expr>>>
pub fn as_switch_mut(&mut self) -> Option<&mut Vec<SwitchCase<Expr>>>
Optionally returns mutable references to the inner fields if this is a ExprKind::Switch
, otherwise None
sourcepub fn as_switch(&self) -> Option<&Vec<SwitchCase<Expr>>>
pub fn as_switch(&self) -> Option<&Vec<SwitchCase<Expr>>>
Optionally returns references to the inner fields if this is a ExprKind::Switch
, otherwise None
sourcepub fn into_switch(self) -> Result<Vec<SwitchCase<Expr>>, Self>
pub fn into_switch(self) -> Result<Vec<SwitchCase<Expr>>, Self>
Returns the inner fields if this is a ExprKind::Switch
, otherwise returns back the enum in the Err
case of the result
sourcepub fn as_built_in_function_mut(
&mut self
) -> Option<(&mut String, &mut Vec<Expr>)>
pub fn as_built_in_function_mut(
&mut self
) -> Option<(&mut String, &mut Vec<Expr>)>
Optionally returns mutable references to the inner fields if this is a ExprKind::BuiltInFunction
, otherwise None