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
sourceimpl<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 + Eq + ToString,
pub fn neq(self, other: Guard<T>) -> Selfwhere
T: Debug + Eq + ToString,
pub fn le(self, other: Guard<T>) -> Selfwhere
T: Debug + Eq + ToString,
pub fn lt(self, other: Guard<T>) -> Selfwhere
T: Debug + Eq + ToString,
pub fn ge(self, other: Guard<T>) -> Selfwhere
T: Debug + Eq + ToString,
pub fn gt(self, other: Guard<T>) -> Selfwhere
T: Debug + Eq + ToString,
sourceimpl<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.
sourceimpl 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
sourceimpl<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;
sourceimpl<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;
sourcefn bitand_assign(&mut self, other: Self)
fn bitand_assign(&mut self, other: Self)
&=
operation. Read moresourceimpl<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;
sourceimpl<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;
sourcefn bitor_assign(&mut self, other: Self)
fn bitor_assign(&mut self, other: Self)
|=
operation. Read moresourceimpl<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.
1.21.0 · sourcefn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 · sourcefn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
sourceimpl<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
sourcefn partial_cmp(&self, other: &Self) -> Option<Ordering>
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
1.0.0 · sourcefn 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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
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,
fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
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,
fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key
and return true
if they are equal.