pub enum Guard<T> {
Or(Box<Guard<T>>, Box<Guard<T>>),
And(Box<Guard<T>>, Box<Guard<T>>),
Not(Box<Guard<T>>),
True,
CompOp(PortComp, RRC<Port>, RRC<Port>),
Port(RRC<Port>),
Info(T),
}
Expand description
An assignment guard which has pointers to the various ports from which it reads.
Variants§
Or(Box<Guard<T>>, Box<Guard<T>>)
Represents c1 || c2
.
And(Box<Guard<T>>, Box<Guard<T>>)
Represents c1 && c2
.
Not(Box<Guard<T>>)
Represents !c1
True
The constant true
CompOp(PortComp, RRC<Port>, RRC<Port>)
Comparison operator.
Port(RRC<Port>)
Uses the value on a port as the condition. Same as p1 == true
Info(T)
Other types of information.
Implementations§
source§impl<T> Guard<T>
impl<T> Guard<T>
sourcepub fn is_true(&self) -> bool
pub fn is_true(&self) -> bool
Returns true definitely Guard::True
.
Returning false does not mean that the guard is not true.
sourcepub fn is_false(&self) -> bool
pub fn is_false(&self) -> bool
Checks if the guard is always false. Returning false does not mean that the guard is not false.
sourcepub fn is_not_done(&self, cell_name: &Id) -> bool
pub fn is_not_done(&self, cell_name: &Id) -> bool
returns true if the self is !cell_name, false otherwise.
sourcepub fn update<F>(&mut self, upd: F)where
F: FnOnce(Guard<T>) -> Guard<T>,
pub fn update<F>(&mut self, upd: F)where F: FnOnce(Guard<T>) -> Guard<T>,
Update the guard in place. Replaces this guard with upd(self)
.
Uses std::mem::take
for the in-place update.
pub fn port(p: RRC<Port>) -> Self
pub fn and(self, rhs: Guard<T>) -> Selfwhere T: Eq,
pub fn or(self, rhs: Guard<T>) -> Selfwhere T: Eq,
pub fn eq(self, other: Guard<T>) -> Selfwhere T: Debug,
pub fn neq(self, other: Guard<T>) -> Selfwhere T: Debug,
pub fn le(self, other: Guard<T>) -> Selfwhere T: Debug,
pub fn lt(self, other: Guard<T>) -> Selfwhere T: Debug,
pub fn ge(self, other: Guard<T>) -> Selfwhere T: Debug,
pub fn gt(self, other: Guard<T>) -> Selfwhere T: Debug,
source§impl<T> Guard<T>
impl<T> Guard<T>
Helper functions for the guard.
sourcepub fn for_each<F>(&mut self, f: &mut F)where
F: FnMut(RRC<Port>) -> Option<Guard<T>>,
pub fn for_each<F>(&mut self, f: &mut F)where F: FnMut(RRC<Port>) -> Option<Guard<T>>,
Mutates a guard by calling f
on every leaf in the
guard tree and replacing the leaf with the guard that f
returns.
source§impl Guard<StaticTiming>
impl Guard<StaticTiming>
sourcepub fn add_interval(&mut self, timing_interval: StaticTiming)
pub fn add_interval(&mut self, timing_interval: StaticTiming)
updates self -> self & interval
Trait Implementations§
source§impl<T> BitAnd<Guard<T>> for Guard<T>where
T: Eq,
impl<T> BitAnd<Guard<T>> for Guard<T>where T: Eq,
Construct a Guard::And:
let and_guard = g1 & g2;
source§impl<T> BitAndAssign<Guard<T>> for Guard<T>where
T: Eq,
impl<T> BitAndAssign<Guard<T>> for Guard<T>where T: Eq,
Update a Guard with Or.
g1 &= g2;
source§fn bitand_assign(&mut self, other: Self)
fn bitand_assign(&mut self, other: Self)
&=
operation. Read moresource§impl<T> BitOr<Guard<T>> for Guard<T>where
T: Eq,
impl<T> BitOr<Guard<T>> for Guard<T>where T: Eq,
Construct a Guard::Or:
let or_guard = g1 | g2;
source§impl<T> BitOrAssign<Guard<T>> for Guard<T>where
T: Eq,
impl<T> BitOrAssign<Guard<T>> for Guard<T>where T: Eq,
Update a Guard with Or.
g1 |= g2;
source§fn bitor_assign(&mut self, other: Self)
fn bitor_assign(&mut self, other: Self)
|=
operation. Read moresource§impl<T> Ord for Guard<T>where
T: Eq,
impl<T> Ord for Guard<T>where T: Eq,
Define an ordering on the precedence of guards. Guards are considered equal when they have the same precedence.
source§impl<T> PartialEq<Guard<T>> for Guard<T>where
T: Eq,
impl<T> PartialEq<Guard<T>> for Guard<T>where T: Eq,
source§impl<T> PartialOrd<Guard<T>> for Guard<T>where
T: Eq,
impl<T> PartialOrd<Guard<T>> for Guard<T>where T: Eq,
Define order on guards
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moreimpl<T> Eq for Guard<T>where T: Eq,
Auto Trait Implementations§
impl<T> !RefUnwindSafe for Guard<T>
impl<T> !Send for Guard<T>
impl<T> !Sync for Guard<T>
impl<T> Unpin for Guard<T>where T: Unpin,
impl<T> !UnwindSafe for Guard<T>
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
source§impl<Q, K> Equivalent<K> for Qwhere
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Qwhere Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,
source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.