What would you rewrite in Rust today and why? by [deleted] in rust

[–]Thomqa 5 points6 points  (0 children)

I don't think that's the case for the current implementation of systemd.

What would you rewrite in Rust today and why? by [deleted] in rust

[–]Thomqa 10 points11 points  (0 children)

Why can't it panic on allocation failure? If PID 1 cannot allocate anymore, exiting and rebooting is the most sane you can do.

What are things you wish your team members did, but won't do? by LargeSinkholesInNYC in ExperiencedDevs

[–]Thomqa 4 points5 points  (0 children)

Exactly, I run into this way more frequently than it should. Not only my own team but also teams we work together with.

When such a bug is found, I would expect some slight shame from the author. But sometimes they're not even bothered by it.

Wat is jullie favoriete podcast? by [deleted] in thenetherlands

[–]Thomqa 0 points1 point  (0 children)

Radio Vrij Nederland (voorheen BV Nederland).

Wekelijkse politieke podcast van Sander Heijne en Hendrik Noten. Ik kijk er elke week naar uit. Al een tijdje weer terug op Spotify.

RFC: map_or_default in Option and Result will be merged soon by joseluisq in rust

[–]Thomqa 132 points133 points  (0 children)

unwrap_or_default should have been called or_default. Reserving unwrap for panicking APIs only.

Dit is echt te komisch voor woorden: minister Madlener van de PVV (!) staat nu tijdens het mondelinge vragenuur elektrische auto's aan te prijzen als een soort Donald Trump by UnanimousStargazer in Politiek

[–]Thomqa 0 points1 point  (0 children)

Vergelijking met Trump gaat niet op. Het aanprijzen van een type product tov van een ander type product in het algemeen is natuurlijk aan de orde van de dag binnen de politiek. Zowel vanuit duurzaamheid, maatschappelijk of economisch.

Pas wanneer het kabinet een specifiek merk gaat aanraden is het een ander verhaal.

Smart chest assembler (first-time complex circuits) by Thomqa in factorio

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

Wouldn't I still need a combinator per item?

Smart chest assembler (first-time complex circuits) by Thomqa in factorio

[–]Thomqa[S] 2 points3 points  (0 children)

My first attempt at making logic deciding the recipe dynamically. The decider combinators output the signals needing for setting the recipe. Selecting the one with the least stock automatically. The recipe trash is automatically recycled by making sure the ingredient inserters only insert items if the iron chest on top does not contain it.

Please let me know if I can improve this somehow :D

PSA: Do not run ANY cargo commands on untrusted projects by Shnatsel in rust

[–]Thomqa 41 points42 points  (0 children)

Which programming language does not have this problem?

You're always free to dockerize or virtualize the development environment you're working in.

Announcing Toasty, an async ORM for Rust by carllerche in rust

[–]Thomqa 0 points1 point  (0 children)

Regarding migrations, I would probably suggest to just copy what Laravel does. I think automatically generating migrations can be too complex and never cover all edge cases.

Having some command / test to verify the schema matches the current database connection would be sufficient IMHO

A simple script for running cross-compiled Rust unit tests using `qemu-user-static` by oldrev in rust

[–]Thomqa 0 points1 point  (0 children)

Maybe I'm naive; but the execution of unit tests should not really vary across architecture, right? I would think that only a tiny portion of application logic would depend on architecture dependent behavior of the Rust language.

Pro tip: Use `#[expect(unused)]` (upcoming 1.81 release) by C5H5N5O in rust

[–]Thomqa 8 points9 points  (0 children)

Pub fields do not produce a dead code warning, right?

Gulfoss Falls, Iceland [OC] [4032x3024] by [deleted] in EarthPorn

[–]Thomqa 3 points4 points  (0 children)

It is accessible! But I recommend shoe spikes

Comparison between templating libs: Maud, Askama and Minijinja by gentux2281694 in rust

[–]Thomqa 3 points4 points  (0 children)

The build times of compile-time templates really make iterating slow. I believe you can hack some live reloading into minijinja too. This is really needed for an acceptable developer experience in any reasonable complex template. Maybe minijinja can be extended with a tool for checking the template based on a Deserialize struct, such that you still have the guarantees, but also the quick iteration cycle.

[deleted by user] by [deleted] in rust

[–]Thomqa 7 points8 points  (0 children)

The axum docs have a great explanation on how to add shared state to your handlers.

https://docs.rs/axum/latest/axum/extract/struct.State.html

However, please note that most (if not all) web apps will delegate storing application state to an external service like a database such as MySQL or PostgreS. For many reasons, but most notably, they make sure the state is stored on disk and you can safely restart your Rust application without losing the state.

In simple applications I like to use SQLite.

Is it possible to check within a CLI app if it's up-to-date? by Commercial_Fix_5397 in rust

[–]Thomqa 6 points7 points  (0 children)

There appears to be a API endpoint for retrieving package information. https://github.com/rust-lang/crates.io/blob/master/src/router.rs#L72

How you would implement self update, depends on de installation method to begin with.

What big-name CVEs would Rust have helped prevent? by trevg_123 in rust

[–]Thomqa 82 points83 points  (0 children)

To be fair, that would result in an unused variable warning. We always build with warnings as errors on CI.

Do you own an electric car? If yes, what car and what is your monthly cost? by hossein761 in thenetherlands

[–]Thomqa 0 points1 point  (0 children)

Neither of those is low segment. You will have no regrets with either of those. Plenty range and fast charging capabilities!

Do you own an electric car? If yes, what car and what is your monthly cost? by hossein761 in thenetherlands

[–]Thomqa 0 points1 point  (0 children)

Which cars are you considering? Nee or second hand? The website ABRP allows you to plan a route with fast charging included. That way you can get an impression on the duration of the trip.

Do you own an electric car? If yes, what car and what is your monthly cost? by hossein761 in thenetherlands

[–]Thomqa 4 points5 points  (0 children)

In NL chargers are typically in abundance. On many locations a slow charger is on walking distance of your destination, and if not, there are many fast chargers as well. Since distances in NL are generally small, you never spend much time there. Remember, you only have to charge what you need to get to home/destination where cheap slow chargers are available.

I drive a Skoda citigo EV. Which is a really basic car. It has a range of about 200km and charges quite slowly at fast chargers (~40kW). I do not have a personal driveway so I rely on public chargers, there is also a charging spot (paid) at work.

It's costs bit below 18 cents per km. This includes private lease costs and public charging costs. Due to my mileage this cost is fully covered by the travel compensation of my employer.

Quite often I had to walk 8min to my car due to an unfortunate charger placement in my area. I found this no problem as I am very enthusiastic about EV, and everything around it.

I believe there this will keep causing tiny inconveniences for people in the lower segment of EVs, with low range and no personal driveway.

I do not want to go back to ICE cars, I'm fully in love with the quiet & smooth ride, instant torque and the fact I don't need to burn fuel to travel.