From 373860674228f199c57344be19a4e32c759371e9 Mon Sep 17 00:00:00 2001 From: D4VID Date: Mon, 18 Aug 2025 20:16:27 +0200 Subject: [PATCH] Add constructors for PegAddress --- logicworld-subassembly/src/lw.rs | 24 ++++++++++++++++++++---- 1 file changed, 20 insertions(+), 4 deletions(-) diff --git a/logicworld-subassembly/src/lw.rs b/logicworld-subassembly/src/lw.rs index 1de8ca4..4a3fb17 100644 --- a/logicworld-subassembly/src/lw.rs +++ b/logicworld-subassembly/src/lw.rs @@ -74,6 +74,22 @@ pub struct PegAddress { component_address: ComponentAddress, index: Int, } +impl PegAddress { + pub fn input(component_address: ComponentAddress, index: Int) -> Self { + Self { + peg_type: PegType::Input, + component_address, + index, + } + } + pub fn output(component_address: ComponentAddress, index: Int) -> Self { + Self { + peg_type: PegType::Output, + component_address, + index, + } + } +} #[derive(BinarySerializable)] pub struct Component { @@ -89,10 +105,10 @@ pub struct Component { #[derive(BinarySerializable)] pub struct Wire { - first_point: PegAddress, - second_point: PegAddress, - circuit_state_id: Int, - wire_rotation: Float, + pub first_point: PegAddress, + pub second_point: PegAddress, + pub circuit_state_id: Int, + pub wire_rotation: Float, } pub struct CircuitBoard {