pub enum Predicate {
Show 16 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(Set<Predicate>),
And(Box<Predicate>, Box<Predicate>),
Not(Box<Predicate>),
Failure,
}
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(Set<Predicate>)
And(Box<Predicate>, Box<Predicate>)
Not(Box<Predicate>)
Failure
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_type_satisfies(&self, f: impl Fn(&Type) -> bool + Copy) -> bool
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>
pub fn contains_value(&self, value: &ValueObj) -> bool
pub fn contains_tp(&self, tp: &TyParam) -> bool
pub fn contains_t(&self, t: &Type) -> bool
pub fn _replace_tp( self, target: &TyParam, to: &TyParam, tvs: &SharedFrees, ) -> Self
pub fn replace_tp(self, target: &TyParam, to: &TyParam) -> Self
pub fn _replace_t(self, target: &Type, to: &Type, tvs: &SharedFrees) -> Self
pub fn dereference(&mut self)
pub fn map_t(self, f: &mut impl FnMut(Type) -> Type, tvs: &SharedFrees) -> Self
pub fn map_tp( self, f: &mut impl FnMut(TyParam) -> TyParam, tvs: &SharedFrees, ) -> Self
pub fn try_map_tp<E>( self, f: &mut impl FnMut(TyParam) -> Result<TyParam, E>, tvs: &SharedFrees, ) -> Result<Self, E>
Trait Implementations§
Source§impl LimitedDisplay for Predicate
impl LimitedDisplay for Predicate
Source§fn limited_fmt<W: Write>(&self, f: &mut W, limit: isize) -> Result
fn limited_fmt<W: Write>(&self, f: &mut W, limit: isize) -> Result
If
limit
was set to a negative value, it will be displayed without abbreviation.
FIXME:fn to_string_unabbreviated(&self) -> String
const DEFAULT_LIMIT: isize = 10isize
Source§impl StructuralEq for Predicate
impl StructuralEq for Predicate
fn structural_eq(&self, other: &Self) -> bool
impl Eq for Predicate
impl Immutable for Predicate
impl StructuralPartialEq for Predicate
Auto Trait Implementations§
impl Freeze for Predicate
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