finish applying port autoconnect refactor, move entry point to top level, update usage

This commit is contained in:
🪞👃🪞 2025-01-09 21:56:47 +01:00
parent fe70b57dc1
commit c3de403645
9 changed files with 126 additions and 102 deletions

View file

@ -62,6 +62,15 @@ pub struct PortConnection {
pub status: Vec<(Port<Unowned>, PortConnectionStatus)>,
}
impl PortConnection {
pub fn collect (exact: &[impl AsRef<str>], re: &[impl AsRef<str>], re_all: &[impl AsRef<str>])
-> Vec<Self>
{
let mut connections = vec![];
for port in exact.iter() { connections.push(Self::exact(port)) }
for port in re.iter() { connections.push(Self::regexp(port)) }
for port in re_all.iter() { connections.push(Self::regexp_all(port)) }
connections
}
/// Connect to this exact port
pub fn exact (name: impl AsRef<str>) -> Self {
let name = PortConnectionName::Exact(name.as_ref().into());