(s: &str)
| 80 | } |
| 81 | |
| 82 | pub(super) fn parse<T>(s: &str) -> (String, AnyPort<std::sync::Arc<T>>) { |
| 83 | let mut ss = s.split(':'); |
| 84 | let name = ss.next().unwrap(); |
| 85 | ss.next() |
| 86 | .map(|x| { |
| 87 | if x == "[]" { |
| 88 | ( |
| 89 | format!("[{}]", name), |
| 90 | AnyPort::new(name.to_owned(), PortTy::List), |
| 91 | ) |
| 92 | } else if x == "{}" { |
| 93 | ( |
| 94 | format!("{{{}}}", name), |
| 95 | AnyPort::new(name.to_owned(), PortTy::Dict), |
| 96 | ) |
| 97 | } else { |
| 98 | unreachable!("unexpected port type {}", x) |
| 99 | } |
| 100 | }) |
| 101 | .unwrap_or_else(|| (name.to_owned(), AnyPort::new(name.to_owned(), PortTy::Unit))) |
| 102 | } |
| 103 | |
| 104 | pub(super) fn port_name(s: &str) -> String { |
| 105 | let mut ss = s.split(':'); |
no outgoing calls
no test coverage detected