Enum erg_compiler::ty::predicate::Predicate
source · pub enum Predicate {
Show 15 variants
Value(ValueObj),
Const(Str),
Call {
receiver: TyParam,
name: Option<Str>,
args: Vec<TyParam>,
},
Attr {
receiver: TyParam,
name: Str,
},
Equal {
lhs: Str,
rhs: TyParam,
},
GreaterEqual {
lhs: Str,
rhs: TyParam,
},
LessEqual {
lhs: Str,
rhs: TyParam,
},
NotEqual {
lhs: Str,
rhs: TyParam,
},
GeneralEqual {
lhs: Box<Predicate>,
rhs: Box<Predicate>,
},
GeneralLessEqual {
lhs: Box<Predicate>,
rhs: Box<Predicate>,
},
GeneralGreaterEqual {
lhs: Box<Predicate>,
rhs: Box<Predicate>,
},
GeneralNotEqual {
lhs: Box<Predicate>,
rhs: Box<Predicate>,
},
Or(Box<Predicate>, Box<Predicate>),
And(Box<Predicate>, Box<Predicate>),
Not(Box<Predicate>),
}
Variants§
Value(ValueObj)
Const(Str)
Call
Attr
Equal
TODO: unify with GeneralEqual i == 0 => Eq{ lhs: “i”, rhs: 0 }
GreaterEqual
i > 0 == i >= 0 and i != 0
LessEqual
NotEqual
GeneralEqual
GeneralLessEqual
GeneralGreaterEqual
GeneralNotEqual
Or(Box<Predicate>, Box<Predicate>)
And(Box<Predicate>, Box<Predicate>)
Not(Box<Predicate>)
Implementations§
source§impl Predicate
impl Predicate
pub const TRUE: Predicate = _
pub const FALSE: Predicate = _
pub fn general_eq(lhs: Predicate, rhs: Predicate) -> Self
pub fn general_ge(lhs: Predicate, rhs: Predicate) -> Self
pub fn general_le(lhs: Predicate, rhs: Predicate) -> Self
pub fn general_ne(lhs: Predicate, rhs: Predicate) -> Self
pub fn call(receiver: TyParam, name: Option<Str>, args: Vec<TyParam>) -> Self
pub fn attr(receiver: TyParam, name: Str) -> Self
pub const fn eq(lhs: Str, rhs: TyParam) -> Self
pub const fn ne(lhs: Str, rhs: TyParam) -> Self
pub fn lt(lhs: Str, rhs: TyParam) -> Self
pub fn and(lhs: Predicate, rhs: Predicate) -> Self
pub fn or(lhs: Predicate, rhs: Predicate) -> Self
pub fn is_equal(&self) -> bool
pub fn consist_of_equal(&self) -> bool
pub fn ands(&self) -> Set<&Predicate>
pub fn ors(&self) -> Set<&Predicate>
pub fn subject(&self) -> Option<&str>
pub fn change_subject_name(self, name: Str) -> Self
pub fn substitute(self, var: &str, tp: &TyParam) -> Self
pub fn mentions(&self, name: &str) -> bool
pub fn can_be_false(&self) -> Option<bool>
pub fn qvars(&self) -> Set<(Str, Constraint)>
pub fn has_qvar(&self) -> bool
pub fn has_unbound_var(&self) -> bool
pub fn has_undoable_linked_var(&self) -> bool
pub fn min_max<'a>( &'a self, min: Option<&'a TyParam>, max: Option<&'a TyParam> ) -> (Option<&'a TyParam>, Option<&'a TyParam>)
pub fn typarams(&self) -> Vec<&TyParam>
pub fn invert(self) -> Self
pub fn possible_tps(&self) -> Vec<&TyParam>
pub fn possible_values(&self) -> Vec<&ValueObj>
pub fn variables(&self) -> Set<Str>
Trait Implementations§
source§impl LimitedDisplay for Predicate
impl LimitedDisplay for Predicate
source§impl PartialEq for Predicate
impl PartialEq for Predicate
source§impl StructuralEq for Predicate
impl StructuralEq for Predicate
fn structural_eq(&self, other: &Self) -> bool
impl Eq for Predicate
impl StructuralPartialEq for Predicate
Auto Trait Implementations§
impl RefUnwindSafe for Predicate
impl Send for Predicate
impl Sync for Predicate
impl Unpin for Predicate
impl UnwindSafe for Predicate
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