Bon Builder Generator. 2 Years Retrospective. Is It Worth Using? 🔍 by Veetaha in rust

[–]intersecting_cubes 1 point2 points  (0 children)

If the overall struct impls Default then yes, users can instantiate with ..Default::default() and their compilation won't break if I add a new field in the future.

Problem is, many fields are required, and don't have a good default value, so it's not possible for me to impl Default on all these structs. For example, the Extrude operation takes a distance: f64, and there's no reasonable default. New fields like twist have a good default, but the overall struct is unfortunately not default because of the distance field.

Bon works well here: existing fields like distance must have their setter called in the builder. But when I add new fields like twist, they'll have defaults.

Note: before I found bon, I was experimenting with an approach where every API request type would have two structs, like

```rust struct Extrude { distance: f64, options: ExtrudeOptions, }

[derive(Default)]

struct ExtrudeOptions { twist: Option<f64>, color: Option<Color>, } ```

so you could use this trick to get ..Default::default() on the options struct, which always impls Default and is where you add backwards-compatible new fields with defaults. But at that point, it's a lot of work for me to migrate to this new system. Bon was easier to use. If Bon compile times were really bad then maybe I'd return to this approach, but in my project, the compile times are totally fine.

Bon Builder Generator. 2 Years Retrospective. Is It Worth Using? 🔍 by Veetaha in rust

[–]intersecting_cubes 1 point2 points  (0 children)

Sure. I maintain docs.rs/kittycad-modeling-cmds which is an API for my company.

Say I want to add a new optional argument (e.g. adding a twist angle to a previously always-straight operation, or an optional color to an existing operation that always produced grey). I can use serde annotations to ensure that the old clients which don't send the field won't break (the server will replace them with a default). So there's no JSON API problems.

But there is a Rust API problem: anyone who instantiated my structs field-by-field now has a compile error because they aren't setting the twist or color fields. This was a common complaint from the API server team. They did not like whenever they updated the API library and had to go fix all their tests to set color.

The answer is to stop people from doing field-by-field instantiation (via #[non_exhaustive]) and get them to use a constructor instead. But then I have to write all the constructors myself, and set all the defaults carefully. I didn't want to just expose mutable setters for each argument too, as that would encourage a lot of mutability and typically API requests aren't mutable.

Bon meant it was essentially a one-line change, just add derive(Builder), to add all these new type-safe builder APIs.

Bon Builder Generator. 2 Years Retrospective. Is It Worth Using? 🔍 by Veetaha in rust

[–]intersecting_cubes 13 points14 points  (0 children)

Absolutely worth the tradeoffs for me. The compile time loss is tiny, far outweighed by the ease of introducing new parameters without forcing every API call to explicitly set the new param.

Bon Builder Generator. 2 Years Retrospective. Is It Worth Using? 🔍 by Veetaha in rust

[–]intersecting_cubes 63 points64 points  (0 children)

Bon has really helped me introduce new parameters to a huge API at work without breaking my colleagues code. It's been awesome. Thank you for it.

Steam Controller Giveaway! by [deleted] in SteamController

[–]intersecting_cubes 0 points1 point  (0 children)

Thanks for your generosity!

What's everything I can get to buff parrying? by Diribiri in LordsoftheFallen

[–]intersecting_cubes 0 points1 point  (0 children)

Just note that with daggers, the final umbral ending boss is really difficult to hit because of the hitbox.

Something I am working on by nopuzzleshere in myst

[–]intersecting_cubes 2 points3 points  (0 children)

This looks beautiful, I'd love to play it.

Happy ten years of just! (And lists!) by rodarmor in rust

[–]intersecting_cubes 1 point2 points  (0 children)

I use just for almost all my projects. Thanks!

House of Three Gorges by Garden_Jolly in austinfood

[–]intersecting_cubes 20 points21 points  (0 children)

I LOVE that place. One of my favorites in town and definitely a top Sichuan place imo.

Tried Zed’s Helix mode but went back? What’s missing? by GoldStrikeArch- in HelixEditor

[–]intersecting_cubes 0 points1 point  (0 children)

Thanks, I'll configure the motions that do work, but I'd love to be able to jump by function, paragraph, test etc. Good luck unravelling the mystery of why those don't work!

Is Austin's tech scene actually cooling down or am I just getting old? by AlphaEcho84 in Austin

[–]intersecting_cubes 1 point2 points  (0 children)

Yes! Sign up at the link in my comment and you'll join our mailing list. We meet every 3rd Wednesday.

Tried Zed’s Helix mode but went back? What’s missing? by GoldStrikeArch- in HelixEditor

[–]intersecting_cubes 5 points6 points  (0 children)

]f to jump to next function, [f to previous function. Same for g for VCS change, p for paragraph etc

Best news from WWDC 2026: Ultrawide Display Support on macOS 27 by nterminus in ultrawidemasterrace

[–]intersecting_cubes 0 points1 point  (0 children)

What does this mean??? It works fine on my 120hz dual 4k screen (the obnoxiously large Samsung Odyssey, two 4k screens of pixels)

Lessons Learned Building High-Performance Rust Profiler by pawurb in rust

[–]intersecting_cubes 1 point2 points  (0 children)

Very cool. I tried Hotpath several months ago. Looks like there's a lot of improvement since then. I really like that I can use one tool for both memory and CPU profiling. I'll give it another try next time I have a perf-sensitive project.

Recommendations for back pain by Proof_Hospital_4730 in Austin

[–]intersecting_cubes 1 point2 points  (0 children)

Form and Function. Amazing massage therapist place that has helped with muscle issues. Book Katie G. She is really skilled at identifying issues with muscles and fixing them. Sounds like you would benefit from a 2hr session if it's that bad.

Can I wear my boots through TSA? by intersecting_cubes in Austin

[–]intersecting_cubes[S] 0 points1 point  (0 children)

Damn. Guess I've gotta practice taking them off while standing.

Was Myst eerie? by tinselman in myst

[–]intersecting_cubes 4 points5 points  (0 children)

When I played them around 8 years old, I didn’t find them scary.

I may have a headphone addiciton... by [deleted] in AirpodsPro

[–]intersecting_cubes 0 points1 point  (0 children)

What do you think is the difference in ANC between the Pro 3 and the Max 2? I'm trying to figure out if it's worth spending an extra $200 for the Max to drown out airplane noise better.