From 4ef0ed6adaf8213b2ebe546fb87336641917dbe9 Mon Sep 17 00:00:00 2001 From: Adam Chalmers Date: Mon, 30 Mar 2026 11:55:51 -0500 Subject: [PATCH] Move enum fields into structs This is purely a refactor, I don't expect any behavioural changes. Purpose of the refactor is: Bon (our builder API macro crate) doesn't work on enums. But some enums have struct-like named fields, making them very close to a struct and therefore having all the same problems, e.g. when you add a field, it'll cause compile errors in the engine, forcing people to handle those new fields. Solution is to move those enum fields into a new struct, which CAN have the Builder derive on it. This is going to make the new Face API easier to integrate by causing fewer compile errors. Also incidentally bump rustls --- Cargo.lock | 18 +++++++------- modeling-cmds/openapi/api.json | 2 ++ modeling-cmds/src/shared.rs | 44 +++++++++++++++++++++++++++------- 3 files changed, 47 insertions(+), 17 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index d66bf333..2ae86bf6 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1924,7 +1924,7 @@ dependencies = [ "http", "hyper", "hyper-util", - "rustls 0.23.35", + "rustls 0.23.37", "rustls-native-certs", "rustls-pki-types", "tokio", @@ -3582,7 +3582,7 @@ dependencies = [ "quinn-proto", "quinn-udp", "rustc-hash", - "rustls 0.23.35", + "rustls 0.23.37", "socket2 0.6.1", "thiserror 2.0.18", "tokio", @@ -3602,7 +3602,7 @@ dependencies = [ "rand 0.9.2", "ring", "rustc-hash", - "rustls 0.23.35", + "rustls 0.23.37", "rustls-pki-types", "slab", "thiserror 2.0.18", @@ -3924,7 +3924,7 @@ dependencies = [ "percent-encoding", "pin-project-lite", "quinn", - "rustls 0.23.35", + "rustls 0.23.37", "rustls-native-certs", "rustls-pki-types", "serde", @@ -4159,9 +4159,9 @@ dependencies = [ [[package]] name = "rustls" -version = "0.23.35" +version = "0.23.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "533f54bc6a7d4f647e46ad909549eda97bf5afc1585190ef692b4286b198bd8f" +checksum = "758025cb5fccfd3bc2fd74708fd4682be41d99e5dff73c377c0646c6012c73a4" dependencies = [ "once_cell", "ring", @@ -5111,7 +5111,7 @@ version = "0.26.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1729aa945f29d91ba541258c8df89027d5792d85a8841fb65e8bf0f4ede4ef61" dependencies = [ - "rustls 0.23.35", + "rustls 0.23.37", "tokio", ] @@ -5703,7 +5703,7 @@ dependencies = [ "ring", "rtcp", "rtp", - "rustls 0.23.35", + "rustls 0.23.37", "sdp", "serde", "serde_json", @@ -5765,7 +5765,7 @@ dependencies = [ "rand_core 0.6.4", "rcgen", "ring", - "rustls 0.23.35", + "rustls 0.23.37", "sec1", "serde", "sha1", diff --git a/modeling-cmds/openapi/api.json b/modeling-cmds/openapi/api.json index 98d4702c..71125012 100644 --- a/modeling-cmds/openapi/api.json +++ b/modeling-cmds/openapi/api.json @@ -1267,6 +1267,7 @@ "type": "object", "properties": { "entity_reference": { + "description": "Extrudes along the normal of the top face until it is as close to the entity as possible. An entity can be a solid, a path, a face, etc.", "type": "object", "properties": { "entity_id": { @@ -1290,6 +1291,7 @@ "type": "object", "properties": { "axis": { + "description": "Extrudes until the top face is as close as possible to this given axis.", "type": "object", "properties": { "axis": { diff --git a/modeling-cmds/src/shared.rs b/modeling-cmds/src/shared.rs index 15463020..65a3624d 100644 --- a/modeling-cmds/src/shared.rs +++ b/modeling-cmds/src/shared.rs @@ -1191,17 +1191,15 @@ pub enum ExtrudeReference { /// Extrudes along the normal of the top face until it is as close to the entity as possible. /// An entity can be a solid, a path, a face, etc. EntityReference { - /// The UUID of the entity to extrude to. - entity_id: Uuid, + /// What to extrude to. + #[serde(flatten)] + target: ExtrudeReferenceEntity, }, /// Extrudes until the top face is as close as possible to this given axis. Axis { - /// The axis to extrude to. - axis: Point3d, - /// Point the axis goes through. - /// Defaults to (0, 0, 0). - #[serde(default)] - point: Point3d, + /// What to extrude to. + #[serde(flatten)] + target: ExtrudeReferenceAxis, }, /// Extrudes until the top face is as close as possible to this given point. Point { @@ -1210,6 +1208,36 @@ pub enum ExtrudeReference { }, } +/// Extrudes until the top face is as close as possible to this given axis. +#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize, JsonSchema, Builder)] +#[serde(rename_all = "snake_case")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] +#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)] +pub struct ExtrudeReferenceAxis { + /// The axis to extrude to. + pub axis: Point3d, + /// Point the axis goes through. + /// Defaults to (0, 0, 0). + #[serde(default)] + #[builder(default)] + pub point: Point3d, +} + +#[derive(Clone, Copy, Debug, PartialEq, Serialize, Deserialize, JsonSchema, Builder)] +#[serde(rename_all = "snake_case")] +#[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))] +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] +#[cfg_attr(feature = "ts-rs", ts(export_to = "ModelingCmd.ts"))] +#[cfg_attr(not(feature = "unstable_exhaustive"), non_exhaustive)] +/// Extrudes along the normal of the top face until it is as close to the entity as possible. +/// An entity can be a solid, a path, a face, etc. +pub struct ExtrudeReferenceEntity { + /// The UUID of the entity to extrude to. + pub entity_id: Uuid, +} + /// IDs for the extruded faces. #[derive(Debug, PartialEq, Serialize, Deserialize, JsonSchema, Clone, Builder)] #[cfg_attr(feature = "ts-rs", derive(ts_rs::TS))]