pub struct Constraint { /* private fields */ }Expand description
A constraint on the difference between two clocks.
Constraint::le represents x_i - x_j <= c and Constraint::lt
represents x_i - x_j < c. Clock 0 is the fixed reference
Clock::ZERO. Constructing a constraint does not validate it against
a particular DBM; that happens when the constraint is applied.
§Example
use clock_dbm::{Clock, Constraint};
let x = Clock::new(1).unwrap();
let y = Clock::new(2).unwrap();
let x_at_least_two = Constraint::le(Clock::ZERO, x, -2)?;
let x_minus_y_below_three = Constraint::lt(x, y, 3)?;
assert_eq!(x_at_least_two.i(), Clock::ZERO);
assert_eq!(x_minus_y_below_three.j(), y);Implementations§
Source§impl Constraint
impl Constraint
Sourcepub const fn new(i: Clock, j: Clock, bound: Bound) -> Constraint
pub const fn new(i: Clock, j: Clock, bound: Bound) -> Constraint
Constructs a constraint on clock i - clock j using bound.
The bound specifies either < c, <= c, or no restriction.
Both clocks may be the same; validity for a particular zone is
checked when the constraint is applied.
Sourcepub const fn le(i: Clock, j: Clock, c: i32) -> Result<Constraint, Error>
pub const fn le(i: Clock, j: Clock, c: i32) -> Result<Constraint, Error>
Constructs the constraint clock i - clock j <= c.
Returns Error::Range if c is outside the supported bound range.
Sourcepub const fn lt(i: Clock, j: Clock, c: i32) -> Result<Constraint, Error>
pub const fn lt(i: Clock, j: Clock, c: i32) -> Result<Constraint, Error>
Constructs the constraint clock i - clock j < c.
Returns Error::Range if c is outside the supported bound range.
Trait Implementations§
Source§impl Clone for Constraint
impl Clone for Constraint
impl Copy for Constraint
Source§impl Debug for Constraint
impl Debug for Constraint
Source§impl DeepModel for Constraint
impl DeepModel for Constraint
impl Eq for Constraint
Source§impl Hash for Constraint
impl Hash for Constraint
Source§impl PartialEq for Constraint
impl PartialEq for Constraint
impl StructuralPartialEq for Constraint
Source§impl View for Constraint
impl View for Constraint
Auto Trait Implementations§
impl Forget for Constraint
impl Freeze for Constraint
impl Move for Constraint
impl RefUnwindSafe for Constraint
impl Send for Constraint
impl Sync for Constraint
impl Unpin for Constraint
impl UnsafeUnpin for Constraint
impl UnwindSafe for Constraint
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