Enum Predicate

Source
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

Fields

§receiver: TyParam
§name: Option<Str>
§args: Vec<TyParam>
§

Attr

Fields

§receiver: TyParam
§name: Str
§

Equal

TODO: unify with GeneralEqual i == 0 => Eq{ lhs: “i”, rhs: 0 }

Fields

§lhs: Str
§

GreaterEqual

i > 0 == i >= 0 and i != 0

Fields

§lhs: Str
§

LessEqual

Fields

§lhs: Str
§

NotEqual

Fields

§lhs: Str
§

GeneralEqual

Fields

§

GeneralLessEqual

Fields

§

GeneralGreaterEqual

Fields

§

GeneralNotEqual

Fields

§

Or(Set<Predicate>)

§

And(Box<Predicate>, Box<Predicate>)

§

Not(Box<Predicate>)

§

Failure

Implementations§

Source§

impl Predicate

Source

pub const TRUE: Predicate

Source

pub const FALSE: Predicate

Source

pub fn general_eq(lhs: Predicate, rhs: Predicate) -> Self

Source

pub fn general_ge(lhs: Predicate, rhs: Predicate) -> Self

Source

pub fn general_le(lhs: Predicate, rhs: Predicate) -> Self

Source

pub fn general_ne(lhs: Predicate, rhs: Predicate) -> Self

Source

pub fn call(receiver: TyParam, name: Option<Str>, args: Vec<TyParam>) -> Self

Source

pub fn attr(receiver: TyParam, name: Str) -> Self

Source

pub const fn eq(lhs: Str, rhs: TyParam) -> Self

Source

pub const fn ne(lhs: Str, rhs: TyParam) -> Self

Source

pub const fn ge(lhs: Str, rhs: TyParam) -> Self

=

Source

pub fn gt(lhs: Str, rhs: TyParam) -> Self

(>= and !=)

Source

pub const fn le(lhs: Str, rhs: TyParam) -> Self

<=

Source

pub fn lt(lhs: Str, rhs: TyParam) -> Self

Source

pub fn and(lhs: Predicate, rhs: Predicate) -> Self

Source

pub fn or(lhs: Predicate, rhs: Predicate) -> Self

Source

pub fn is_equal(&self) -> bool

Source

pub fn consist_of_equal(&self) -> bool

Source

pub fn ands(&self) -> Set<&Predicate>

Source

pub fn ors(&self) -> Set<&Predicate>

Source

pub fn subject(&self) -> Option<&str>

Source

pub fn change_subject_name(self, name: Str) -> Self

Source

pub fn substitute(self, var: &str, tp: &TyParam) -> Self

Source

pub fn mentions(&self, name: &str) -> bool

Source

pub fn can_be_false(&self) -> Option<bool>

Source

pub fn qvars(&self) -> Set<(Str, Constraint)>

Source

pub fn has_type_satisfies(&self, f: impl Fn(&Type) -> bool + Copy) -> bool

Source

pub fn has_qvar(&self) -> bool

Source

pub fn has_unbound_var(&self) -> bool

Source

pub fn has_undoable_linked_var(&self) -> bool

Source

pub fn min_max<'a>( &'a self, min: Option<&'a TyParam>, max: Option<&'a TyParam>, ) -> (Option<&'a TyParam>, Option<&'a TyParam>)

Source

pub fn typarams(&self) -> Vec<&TyParam>

Source

pub fn invert(self) -> Self

Source

pub fn possible_tps(&self) -> Vec<&TyParam>

Source

pub fn possible_values(&self) -> Vec<&ValueObj>

Source

pub fn variables(&self) -> Set<Str>

Source

pub fn contains_value(&self, value: &ValueObj) -> bool

Source

pub fn contains_tp(&self, tp: &TyParam) -> bool

Source

pub fn contains_t(&self, t: &Type) -> bool

Source

pub fn _replace_tp( self, target: &TyParam, to: &TyParam, tvs: &SharedFrees, ) -> Self

Source

pub fn replace_tp(self, target: &TyParam, to: &TyParam) -> Self

Source

pub fn _replace_t(self, target: &Type, to: &Type, tvs: &SharedFrees) -> Self

Source

pub fn dereference(&mut self)

Source

pub fn map_t(self, f: &mut impl FnMut(Type) -> Type, tvs: &SharedFrees) -> Self

Source

pub fn map_tp( self, f: &mut impl FnMut(TyParam) -> TyParam, tvs: &SharedFrees, ) -> Self

Source

pub fn try_map_tp<E>( self, f: &mut impl FnMut(TyParam) -> Result<TyParam, E>, tvs: &SharedFrees, ) -> Result<Self, E>

Trait Implementations§

Source§

impl BitAnd for Predicate

Source§

type Output = Predicate

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: Self) -> Self::Output

Performs the & operation. Read more
Source§

impl BitOr for Predicate

Source§

type Output = Predicate

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: Self) -> Self::Output

Performs the | operation. Read more
Source§

impl Clone for Predicate

Source§

fn clone(&self) -> Predicate

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Predicate

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Default for Predicate

Source§

fn default() -> Predicate

Returns the “default value” for a type. Read more
Source§

impl Display for Predicate

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl HasLevel for Predicate

Source§

fn level(&self) -> Option<usize>

Source§

fn set_level(&self, level: usize)

Source§

fn set_lower(&self, level: Level)

Source§

fn lift(&self)

Source§

fn lower(&self)

Source§

fn generalize(&self)

Source§

fn is_generalized(&self) -> bool

Source§

impl Hash for Predicate

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl LimitedDisplay for Predicate

Source§

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:
Source§

fn to_string_unabbreviated(&self) -> String

Source§

const DEFAULT_LIMIT: isize = 10isize

Source§

impl Not for Predicate

Source§

type Output = Predicate

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
Source§

impl PartialEq for Predicate

Source§

fn eq(&self, other: &Predicate) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl StructuralEq for Predicate

Source§

fn structural_eq(&self, other: &Self) -> bool

Source§

impl Eq for Predicate

Source§

impl Immutable for Predicate

Source§

impl StructuralPartialEq for Predicate

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.