pub struct UWD<T, J> { /* private fields */ }Expand description
An undirected wiring diagram (UWD).
Implementations§
Source§impl<T, J> UWD<T, J>
impl<T, J> UWD<T, J>
Sourcepub fn with_ports(outer_ports: Ports<T>) -> Self
pub fn with_ports(outer_ports: Ports<T>) -> Self
Constructs a UWD with the given interface for its outer ports.
Sourcepub fn boxes(
&self,
) -> impl Iterator<Item = (&NameSegment, &LabelSegment, &Ports<T>)>
pub fn boxes( &self, ) -> impl Iterator<Item = (&NameSegment, &LabelSegment, &Ports<T>)>
Iterates over the diagram’s boxes along with their ports.
Sourcepub fn outer_ports(&self) -> &Ports<T>
pub fn outer_ports(&self) -> &Ports<T>
Gets the diagram’s outer ports.
Sourcepub fn has_box(&self, box_name: NameSegment) -> bool
pub fn has_box(&self, box_name: NameSegment) -> bool
Returns whether the diagram contains a box.
Sourcepub fn has_port(&self, box_name: NameSegment, port_name: NameSegment) -> bool
pub fn has_port(&self, box_name: NameSegment, port_name: NameSegment) -> bool
Returns whether the diagram contains a box with a specific port.
Sourcepub fn has_outer_port(&self, port_name: NameSegment) -> bool
pub fn has_outer_port(&self, port_name: NameSegment) -> bool
Returns whether the diagram contains an outer port.
Sourcepub fn add_box(&mut self, name: NameSegment, label: LabelSegment)
pub fn add_box(&mut self, name: NameSegment, label: LabelSegment)
Adds a box with empty interface.
Sourcepub fn add_box_with_ports(
&mut self,
name: NameSegment,
label: LabelSegment,
ports: Ports<T>,
)
pub fn add_box_with_ports( &mut self, name: NameSegment, label: LabelSegment, ports: Ports<T>, )
Adds a box with the given interface.
Sourcepub fn add_port(
&mut self,
box_name: NameSegment,
port_name: NameSegment,
label: LabelSegment,
ty: T,
) -> Option<()>
pub fn add_port( &mut self, box_name: NameSegment, port_name: NameSegment, label: LabelSegment, ty: T, ) -> Option<()>
Adds a port to a box.
Sourcepub fn add_outer_port(&mut self, name: NameSegment, label: LabelSegment, ty: T)
pub fn add_outer_port(&mut self, name: NameSegment, label: LabelSegment, ty: T)
Adds a port to the outer box.
Source§impl<T: Clone + Eq, J: Clone + Eq + Hash> UWD<T, J>
impl<T: Clone + Eq, J: Clone + Eq + Hash> UWD<T, J>
Sourcepub fn has_junction(&self, junction: &J) -> bool
pub fn has_junction(&self, junction: &J) -> bool
Returns whether the diagram contains a junction.
Sourcepub fn get(&self, box_name: NameSegment, port_name: NameSegment) -> Option<&J>
pub fn get(&self, box_name: NameSegment, port_name: NameSegment) -> Option<&J>
Gets the junction assigned to a port on a box, if any.
Sourcepub fn get_outer(&self, port_name: NameSegment) -> Option<&J>
pub fn get_outer(&self, port_name: NameSegment) -> Option<&J>
Gets the junction assigned to an outer port, if any.
Sourcepub fn set(
&mut self,
box_name: NameSegment,
port_name: NameSegment,
junction: J,
) -> Option<()>
pub fn set( &mut self, box_name: NameSegment, port_name: NameSegment, junction: J, ) -> Option<()>
Assigns a port on a box to a junction.
Sourcepub fn set_outer(&mut self, port_name: NameSegment, junction: J) -> Option<()>
pub fn set_outer(&mut self, port_name: NameSegment, junction: J) -> Option<()>
Assigns an outer port to a junction.
Trait Implementations§
Auto Trait Implementations§
impl<T, J> Freeze for UWD<T, J>
impl<T, J> RefUnwindSafe for UWD<T, J>where
J: RefUnwindSafe,
T: RefUnwindSafe,
impl<T, J> Send for UWD<T, J>
impl<T, J> Sync for UWD<T, J>
impl<T, J> Unpin for UWD<T, J>
impl<T, J> UnwindSafe for UWD<T, J>where
J: UnwindSafe,
T: 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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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§impl<T> Pointable for T
impl<T> Pointable for T
§impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
impl<SS, SP> SupersetOf<SS> for SPwhere
SS: SubsetOf<SP>,
§fn to_subset(&self) -> Option<SS>
fn to_subset(&self) -> Option<SS>
The inverse inclusion map: attempts to construct
self from the equivalent element of its
superset. Read more§fn is_in_subset(&self) -> bool
fn is_in_subset(&self) -> bool
Checks if
self is actually part of its subset T (and can be converted to it).§fn to_subset_unchecked(&self) -> SS
fn to_subset_unchecked(&self) -> SS
Use with care! Same as
self.to_subset but without any property checks. Always succeeds.§fn from_subset(element: &SS) -> SP
fn from_subset(element: &SS) -> SP
The inclusion map: converts
self to the equivalent element of its superset.