From 9287f8a013f2980951788efc37377c0bf6622c82 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BF=98=E5=BF=A7=E5=8C=97=E8=90=B1=E8=8D=89?= Date: Fri, 19 Apr 2024 02:01:32 +0800 Subject: [PATCH] Iterate over wires --- src/lib.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/lib.rs b/src/lib.rs index 1ad09d4..07f4734 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -428,6 +428,11 @@ impl Snarl { } } + /// Iterates over wires. + pub fn wires(&self) -> impl Iterator + '_ { + self.wires.iter().map(|wire| (wire.out_pin, wire.in_pin)) + } + /// Returns input pin of the node. #[must_use] pub fn in_pin(&self, pin: InPinId) -> InPin {