pub struct LinkTable<K> { /* private fields */ }
Expand description
Table for tracking links between ports.
Two ports are connected when they share the same link. Links are named and scoped via closed regions. Links from one closed region are not visible in another. Open regions are considered to form the same scope as their parent region. Links do not have a unique point of declaration.
The link table keeps track of an association between a key of type K
and
the link indices within each closed region. When resolving links from a text format,
K
is the name of the link as a string slice. However the link table might
is also useful in other contexts where the key is not a string when constructing
a module from a different representation.
§Examples
let mut links = LinkTable::new();
links.enter(RegionId(0));
let foo_0 = links.use_link("foo");
let bar_0 = links.use_link("bar");
assert_eq!(foo_0, links.use_link("foo"));
assert_eq!(bar_0, links.use_link("bar"));
let (num_links, num_ports) = links.exit();
assert_eq!(num_links, 2);
assert_eq!(num_ports, 4);
Implementations§
Source§impl<K> LinkTable<K>
impl<K> LinkTable<K>
Sourcepub fn exit(&mut self) -> (u32, u32)
pub fn exit(&mut self) -> (u32, u32)
Exit a previously entered scope, returning the number of links and ports in the scope.
Trait Implementations§
Auto Trait Implementations§
impl<K> Freeze for LinkTable<K>
impl<K> RefUnwindSafe for LinkTable<K>where
K: RefUnwindSafe,
impl<K> Send for LinkTable<K>where
K: Send,
impl<K> Sync for LinkTable<K>where
K: Sync,
impl<K> Unpin for LinkTable<K>where
K: Unpin,
impl<K> UnwindSafe for LinkTable<K>where
K: UnwindSafe,
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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more