Add constructors for PegAddress

master
D4VID 1 month ago
parent 3ff75d8d16
commit 3738606742

@ -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 {

Loading…
Cancel
Save