pub trait PartialOrderBehaviour {
type Element;
// Required method
fn ge(&self, a: &Self::Element, b: &Self::Element) -> bool;
// Provided methods
fn pc(&self, a: &Self::Element, b: &Self::Element) -> Option<Ordering> { ... }
fn le(&self, a: &Self::Element, b: &Self::Element) -> bool { ... }
fn gt(&self, a: &Self::Element, b: &Self::Element) -> bool { ... }
fn lt(&self, a: &Self::Element, b: &Self::Element) -> bool { ... }
fn eq(&self, a: &Self::Element, b: &Self::Element) -> bool { ... }
fn ip(&self, a: &Self::Element, b: &Self::Element) -> bool { ... }
fn cp(&self, a: &Self::Element, b: &Self::Element) -> bool { ... }
}
Expand description
A trait to represent the behaviour of a partial order.
One needs to define the ‘greater than or equal to’ behaviour. But implementing this trait is not a guarantee that the type is a partial order; this requires care in the function you decide to implement.
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn pc(&self, a: &Self::Element, b: &Self::Element) -> Option<Ordering>
fn pc(&self, a: &Self::Element, b: &Self::Element) -> Option<Ordering>
Returns a partial order comparison between two elements.
Sourcefn le(&self, a: &Self::Element, b: &Self::Element) -> bool
fn le(&self, a: &Self::Element, b: &Self::Element) -> bool
Returns whether a <= b
in the partial order.
Sourcefn gt(&self, a: &Self::Element, b: &Self::Element) -> bool
fn gt(&self, a: &Self::Element, b: &Self::Element) -> bool
Returns whether a > b
in the partial order.
Sourcefn lt(&self, a: &Self::Element, b: &Self::Element) -> bool
fn lt(&self, a: &Self::Element, b: &Self::Element) -> bool
Returns whether a < b
in the partial order.
Sourcefn eq(&self, a: &Self::Element, b: &Self::Element) -> bool
fn eq(&self, a: &Self::Element, b: &Self::Element) -> bool
Returns whether a == b
in the partial order.