Skip to content

Commit 9b43cf4

Browse files
authored
Add methods to DrivenNet to reduce .clone() (#49)
1 parent 81260e6 commit 9b43cf4

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "safety-net"
3-
version = "0.2.4"
3+
version = "0.2.5"
44
edition = "2024"
55
license = "MIT OR Apache-2.0"
66

src/netlist.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1114,6 +1114,20 @@ where
11141114
netlist.expose_net_with_name(self.clone(), name);
11151115
self
11161116
}
1117+
1118+
/// Returns the output position, if the net is the output of a gate.
1119+
pub fn get_output_index(&self) -> Option<usize> {
1120+
if self.netref.is_an_input() {
1121+
None
1122+
} else {
1123+
Some(self.pos)
1124+
}
1125+
}
1126+
1127+
/// Returns the [Instantiable] type driving this net, if it has a driver.
1128+
pub fn get_instance_type(&self) -> Option<Ref<'_, I>> {
1129+
self.netref.get_instance_type()
1130+
}
11171131
}
11181132

11191133
impl<I> std::fmt::Display for DrivenNet<I>

0 commit comments

Comments
 (0)