pub enum Direction {
Input,
Output,
InOut,
}
Expand description
Port directions.
Variants§
Input
Input.
Output
Output.
InOut
Input or output.
Represents ports whose direction is not known at generator elaboration time (e.g. the output of a tristate buffer).
Implementations§
source§impl Direction
impl Direction
sourcepub fn flip(&self) -> Self
pub fn flip(&self) -> Self
Returns the flipped direction.
Direction::InOut
is unchanged by flipping.
§Examples
use scir::Direction;
assert_eq!(Direction::Input.flip(), Direction::Output);
assert_eq!(Direction::Output.flip(), Direction::Input);
assert_eq!(Direction::InOut.flip(), Direction::InOut);
sourcepub fn is_compatible_with(&self, other: Direction) -> bool
pub fn is_compatible_with(&self, other: Direction) -> bool
Test if two nodes of the respective directions are allowed be connected to each other.
§Examples
use scir::Direction;
assert_eq!(Direction::Input.is_compatible_with(Direction::Output), true);
assert_eq!(Direction::Output.is_compatible_with(Direction::Output), false);
assert_eq!(Direction::Output.is_compatible_with(Direction::InOut), true);
Trait Implementations§
source§impl<'de> Deserialize<'de> for Direction
impl<'de> Deserialize<'de> for Direction
source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
source§impl Ord for Direction
impl Ord for Direction
source§impl PartialEq for Direction
impl PartialEq for Direction
source§impl PartialOrd for Direction
impl PartialOrd for Direction
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Copy for Direction
impl Eq for Direction
impl StructuralPartialEq for Direction
Auto Trait Implementations§
impl RefUnwindSafe for Direction
impl Send for Direction
impl Sync for Direction
impl Unpin for Direction
impl UnwindSafe for Direction
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
§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Checks if this value is equivalent to the given key. Read more
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.