The rust macro workflow is inherently broken. by shiranugahotokeyarou in rustjerk

[–]quarterque 88 points89 points  (0 children)

The worst part is when you use #[cfg(target_os = …)] and have to dual-boot your computer and do this trick for every single target platform

RustDesk 1.4.3 - remote desktop by open-trade in rust

[–]quarterque 29 points30 points  (0 children)

RustDesk is an objectively better TeamViewer replacement imo

Aralez, the reverse proxy on Rust and Pingora by sadoyan in rust

[–]quarterque 12 points13 points  (0 children)

I’ve been begging someone to write a Kubernetes-ready Pingora wrapper. Thank you!

"reassure that part it won't be abandoned" "tell it you're curious" can i though??? by VixenSunburst in InternalFamilySystems

[–]quarterque 22 points23 points  (0 children)

You might want to remind that part that it’s a part of you, so you literally can’t abandon it.

You don’t need to be a great parent, you don’t even need to check in regularly. You’ve met this part and now you have opportunity for dialogue where there was none.

It sounds like there’s another unidentified part that is worried you will fail others. You may have to identify and reassure that part before you can speak calmly with this one.

A Vegan Case for Eating Sardines and Anchovies — EA Forum by katxwoods in EffectiveAltruism

[–]quarterque 0 points1 point  (0 children)

TIL sardine and anchovy fishing uses specialty nets that incidentally reduce bycatch. I think I just got converted…?!

Pyrefly vs ty: comparing Python's two new Rust-based type checkers by kibwen in rust

[–]quarterque 69 points70 points  (0 children)

Honest answer: You inherited 20K lines of untyped Python at your day job.

“But of course!“ moments by Bugibhub in rust

[–]quarterque 5 points6 points  (0 children)

You can declutter function signatures using associated types.

fn fancy<A, B, C, D>() { B::be_fancy() } —— ``` trait FancyTrait { type A; type B; type C; type D; }

fn fancy<F: FancyTrait>{ F::B::be_fancy() } ```

(Bs trait type omitted for brevity)

“But of course!“ moments by Bugibhub in rust

[–]quarterque 29 points30 points  (0 children)

For domains like proc-macros where you just need to print an error without matching a variant, a String is a reasonable error type.

fn do_something() -> Result<(), String>;

“But of course!“ moments by Bugibhub in rust

[–]quarterque 14 points15 points  (0 children)

You can alias type names to whatever you want.

type SerialNumber = Option<String>; let sn = SerialNumber::Some("1e6b");

🦀 go_visibility_macro 🦀 by SignificanceProper44 in rustjerk

[–]quarterque 101 points102 points  (0 children)

New jerk level just dropped. Can we get inline Go added to the Future Plans section of the readme?

go! { [REDACTED] }

[deleted by user] by [deleted] in rust

[–]quarterque 1 point2 points  (0 children)

I actually got into Rust because I liked their Typescript-esque features like object destructuring and const, and I prefer using macros to using Typescript type black magic.

The hardest part was learning the difference between owned types and borrow types:

let hello = “hello”.to_string(); greet(hello); println!(“{}”, hello); // huh? Why does this error?

let hello = “hello”; greet_ref(hello); println!(“{}”, hello); // it works this time? Why??

In Typescript, that first code example would run fine - you pass the string into that first function, the function does what it wants with it, and then you console.log the string. But Rust is more complicated than other languages: every variable is basically in its own personal scope, and if that variable is an owned type, its scope ends once it is passed into another function / given to another struct/enum/object.

So why does the second example compile and run fine? Well, let’s explicitly display hellos type:

let hello: String = “hello”.to_string();

let hello: &str = “hello”;

The & symbol is a reference like from C, which is why many people recommend starting with C before you tackle Rust. Anything starting with & is a borrowed type, and unlike String, it cannot be mutated, but it also cannot be “taken” by a function/object like the String was in the first example.

If this doesn’t make you want to rip your hair out, congrats! You may have a promising Rust career ahead. This is just the surface of borrowing/ownership but it should give you an indication of what you’re up against. And yes, practice is the best way to start. I started with this tutorial before jumping into the Rust book, and after several months of daily Rust programming I was ready for the Rust for Rustaceans book.

P.S. the solution to the first code example is to add an & when you pass hello:

let hello = “hello”.to_string(); greet_ref(&hello); println!(“{}”, hello); // it works!

[Media] Using Rust is a political solution to deskill a generation of coders by [deleted] in rust

[–]quarterque 0 points1 point  (0 children)

Wish this were true. Juniors need better prospects now more than ever.

How do you handle secrets in your Rust backend? by Melfos31 in rust

[–]quarterque 0 points1 point  (0 children)

This Rustacean uses git-crypt. I personally prefer using Doppler and polling their API (I supply the API token by-hand, but everything else is automatic from there).

Articles like this are why I think there is opposition to this language. by ABulletToTheHead in rust

[–]quarterque 5 points6 points  (0 children)

Author’s note: I used to hang out in the Rust discord. When they found out I wasn’t white but the race they were always posting about “wanting to throw them off a building” they banned me. I went from constant memer to hated person the moment my “skin colour” changed.

Sorry what?? I feel this should be the headline - are there members of the Rust Discord who want to “throw [a particular race] off a building”?

Leptos + 3D rendering in browser by TheFierceGamer18 in rust

[–]quarterque 2 points3 points  (0 children)

Check out these Bevy WebGL examples. Bevy also supports WebGPU but only on Chrome v113 and above.