Enum prql_compiler::ir::rq::ExprKind
source · pub enum ExprKind {
ColumnRef(CId),
Literal(Literal),
SString(Vec<InterpolateItem<Expr>>),
Case(Vec<SwitchCase<Expr>>),
Operator {
name: String,
args: Vec<Expr>,
},
Param(String),
Array(Vec<Expr>),
}
Variants§
ColumnRef(CId)
Literal(Literal)
SString(Vec<InterpolateItem<Expr>>)
Case(Vec<SwitchCase<Expr>>)
Operator
Param(String)
Placeholder for expressions provided after compilation.
Array(Vec<Expr>)
Implementations§
source§impl ExprKind
impl ExprKind
sourcepub fn is_column_ref(&self) -> bool
pub fn is_column_ref(&self) -> bool
Returns true if this is a ExprKind::ColumnRef
, otherwise false
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, ExprKind>
pub fn into_column_ref(self) -> Result<CId, ExprKind>
Returns the inner fields if this is a ExprKind::ColumnRef
, otherwise returns back the enum in the Err
case of the result
sourcepub fn is_literal(&self) -> bool
pub fn is_literal(&self) -> bool
Returns true if this is a ExprKind::Literal
, otherwise false
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, ExprKind>
pub fn into_literal(self) -> Result<Literal, ExprKind>
Returns the inner fields if this is a ExprKind::Literal
, otherwise returns back the enum in the Err
case of the result
sourcepub fn is_s_string(&self) -> bool
pub fn is_s_string(&self) -> bool
Returns true if this is a ExprKind::SString
, otherwise false
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>>, ExprKind>
pub fn into_s_string(self) -> Result<Vec<InterpolateItem<Expr>>, ExprKind>
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_case_mut(&mut self) -> Option<&mut Vec<SwitchCase<Expr>>>
pub fn as_case_mut(&mut self) -> Option<&mut Vec<SwitchCase<Expr>>>
Optionally returns mutable references to the inner fields if this is a ExprKind::Case
, otherwise None
sourcepub fn as_case(&self) -> Option<&Vec<SwitchCase<Expr>>>
pub fn as_case(&self) -> Option<&Vec<SwitchCase<Expr>>>
Optionally returns references to the inner fields if this is a ExprKind::Case
, otherwise None
sourcepub fn into_case(self) -> Result<Vec<SwitchCase<Expr>>, ExprKind>
pub fn into_case(self) -> Result<Vec<SwitchCase<Expr>>, ExprKind>
Returns the inner fields if this is a ExprKind::Case
, otherwise returns back the enum in the Err
case of the result
sourcepub fn is_operator(&self) -> bool
pub fn is_operator(&self) -> bool
Returns true if this is a ExprKind::Operator
, otherwise false
sourcepub fn as_operator_mut(&mut self) -> Option<(&mut String, &mut Vec<Expr>)>
pub fn as_operator_mut(&mut self) -> Option<(&mut String, &mut Vec<Expr>)>
Optionally returns mutable references to the inner fields if this is a ExprKind::Operator
, otherwise None
sourcepub fn as_operator(&self) -> Option<(&String, &Vec<Expr>)>
pub fn as_operator(&self) -> Option<(&String, &Vec<Expr>)>
Optionally returns references to the inner fields if this is a ExprKind::Operator
, otherwise None
sourcepub fn into_operator(self) -> Result<(String, Vec<Expr>), ExprKind>
pub fn into_operator(self) -> Result<(String, Vec<Expr>), ExprKind>
Returns the inner fields if this is a ExprKind::Operator
, otherwise returns back the enum in the Err
case of the result
sourcepub fn as_param_mut(&mut self) -> Option<&mut String>
pub fn as_param_mut(&mut self) -> Option<&mut String>
Optionally returns mutable references to the inner fields if this is a ExprKind::Param
, otherwise None
sourcepub fn as_param(&self) -> Option<&String>
pub fn as_param(&self) -> Option<&String>
Optionally returns references to the inner fields if this is a ExprKind::Param
, otherwise None
sourcepub fn into_param(self) -> Result<String, ExprKind>
pub fn into_param(self) -> Result<String, ExprKind>
Returns the inner fields if this is a ExprKind::Param
, otherwise returns back the enum in the Err
case of the result
sourcepub fn as_array_mut(&mut self) -> Option<&mut Vec<Expr>>
pub fn as_array_mut(&mut self) -> Option<&mut Vec<Expr>>
Optionally returns mutable references to the inner fields if this is a ExprKind::Array
, otherwise None