Register a SA Forums Account here!
JOINING THE SA FORUMS WILL REMOVE THIS BIG AD, THE ANNOYING UNDERLINED ADS, AND STUPID INTERSTITIAL ADS!!!

You can: log in, read the tech support FAQ, or request your lost password. This dumb message (and those ads) will appear on every screen until you register! Get rid of this crap by registering your own SA Forums Account and joining roughly 150,000 Goons, for the one-time price of $9.95! We charge money because it costs us money per month for bills, and since we don't believe in showing ads to our users, we try to make the money back through forum registrations.
 
  • Post
  • Reply
Ranzear
Jul 25, 2013

Should pop over and send a PR to cargo devs to create a symlink of cargo.toml to rustfmt.toml

No solution speaks louder than the passive aggressive one.

Adbot
ADBOT LOVES YOU

Ranzear
Jul 25, 2013

luchadornado posted:

Oh hey, another Minnesota goon!

Seattle, actually. It's the nordic settlers in common.

Ranzear
Jul 25, 2013

https://twitter.com/m_ou_se/status/1527209443309633536?t=F2wrNi9SYgE_WiFLz2YBtA&s=19

Ranzear
Jul 25, 2013

Imma turn that into a bit of my own question: Is there a downside or reason not to use std::io::prelude::* to just cover everything there?

I know pretty well that embedded stuff tries to pare it all down even to excluding std itself, but for normal everyday code?

Ranzear
Jul 25, 2013

Piggybacking that, how hard would it be and/or what would support proxy passing from nginx like how PHP does it? I like my static serving to be direct and ssl termination even further removed.

Because that's the answer btw: Put your rust service behind something like haproxy so you don't need to gently caress with cert differences across environments. I like the idea of doing everything in rust but also think it's folly when there are dedicated and proven drop in solutions that cover all the edge cases too. Header parsing, load balancing, websocket upgrade rerouting, tls termination, cipher suites/support and preferences... One could implement all this in rust but it's very SEP to me, especially cryptography stuff.

SSL is a deployment hurdle, not an application coding one.

Ranzear fucked around with this message at 02:31 on Sep 19, 2022

Ranzear
Jul 25, 2013

Yeah, not saying it's unhealty or anything to do it yourself for a one-off nonscale project, caveats galore, just that it's better left as somebody else's problem if possible.

Terminating SSL at a proxy layer before load balancing or even just domain level routing is too bulletproof to give up. Not having to reload or even restart your rust app just because certbot fired off this morning is nice too.

Edit: You must mean rusttls btw. I wanted to run it on some game server socketing but then decided much the same to let it be SEP and just run websockets.

Long have aged well jokes about rolling one's own crypto in PHP but this really is just a few steps removed with all the little nontrivial stuff like application layer access to certs (pwn the app and pwn the whole domain, how much do you trust your own code?)

Maybe I'm paranoid. Maybe their code never sees the public facing web. Installations that try to manage their own certs are a giant pain in my rear end (looking at you, GitLab!)

It's a very linux backend environmental perspective rather than a rust development perspective. If one running both Node and rust, there's even more reason for centralizing one's certs with a proxy termination service.

Ranzear fucked around with this message at 03:15 on Sep 19, 2022

Ranzear
Jul 25, 2013

Dominoes posted:

The more dogmatic/idealistic parts of the community need to go away. (Ie the safety woke)
Even the most diehard safety adherents are usually just wrong and dumb. It's wild to me how stuff like private RefCell is still looked upon as a terrible nightmare incarnation that could never ever be seen in competent code. This has come up three different times in online discourse now, two of those persons I almost respected the opinion of.

They're so stuck on following cargo culty "safe patterns" because that was the only way in other languages that they blow right past the protections rust enforces perfectly well on its own. What's really weird to me are the diehard borrow users. Never Rc/Arc, never private members, never thread anything. Always borrow, never think. A lot of footguns with async are related to borrowing too.

Anyway, Tokio just needs to go core. The mere existence of std even beyond weak attempts at Future and whatnot is what makes async a nightmare because then they're forced to completely reimplement instead of just being a drop-in or overload for all these blocking methods. Stop importing std at all and just use Tokio with Full feature and poo poo gets really easy to slam together.

Is that a nuclear hot take that std is the true wart on rust?

Edit: I feel like I should clarify I don't mean the full no_std monty, but just pulling in stuff like alloc explicitly. Treat std like a shopping list. I could probably make the jump to no_std though.

Double edit: Derp, it wasn't Tokio but async_std that had async working with no_std. Looks like that project has cleaned up a bit since I last looked. Still running down the list on my current project and I'm using Tokio's LengthDelimitedCodec too. Bleh. I'm just slamming a single control struct through, wouldn't be hard to replace or frame it myself.

Ranzear fucked around with this message at 10:12 on Oct 26, 2022

Ranzear
Jul 25, 2013

My only tripping point is it seems like msvc just uninstalls itself at random, or maybe wipes its own path entry, and I have to go fix it with MS's stupid installer. That's not really a rust issue but it'd be nice if they'd just circumvent that trash somehow.

Ranzear
Jul 25, 2013

Wrap literally every variable in Rc and it'll still be faster than python.

Ranzear
Jul 25, 2013

To call the turbofish a red herring of learning rust seems too on-the-nose. It takes a relatively high level example to show a use case that isn't more obviously solved by putting a type on a let declaration somewhere.

It comes up in method chaining mostly, specifically a method chain in a match statement or something where somebody just wants to avoid an extra binding, which can definitely be a thing if that match function is running in an iterator.

Ranzear
Jul 25, 2013

Out of date docs will usually flashbang me but it's happening less lately. Really needs something better than orange text in the top corner.

Ranzear
Jul 25, 2013

Just duplicate the damned code, lol. That's exactly what the compiler does with generics anyway.

Ranzear
Jul 25, 2013

I wish I had such (any) tolerance for golang.

Rust compiler: "This is wrong because you're stupid."
Golang compiler: "This is wrong because I'm stupid."

Edit: I held back my phone posting to double check, and Go still doesn't inline any function with generics. 'Just duplicate the code, dingus' is the more performant solution in Go. If that was the joke then I am now twice as offended by the insinuation.

Ranzear fucked around with this message at 05:19 on Mar 6, 2023

Ranzear
Jul 25, 2013

YOUR UNCOOL NIECE posted:

Old crates, bad crates, dumb crates, duplicate crates

And then there's an async implementation of each, and an async runtime that also falls into each.

Ranzear
Jul 25, 2013

prom candy posted:

[...]most of the common problems are just covered out of the box so you can get straight into building your product's specific features. But it's PHP.

Don't forget that Rust is eight years old, and PHP is twenty-eight years old.

Ranzear
Jul 25, 2013

prom candy posted:

I am using Typescript, it was the language that initially made me realize that compilers can tell me when I'm being an idiot and it made me completely fall out of love with Ruby.

Then again there's also Go...

Ranzear
Jul 25, 2013

Ranzear posted:

Rust compiler: "This is wrong because you're stupid."
Golang compiler: "This is wrong because I'm stupid."

I still love this post. There really is a difference between a strict compiler and an actually helpful compiler.

Ranzear
Jul 25, 2013

PYF error handling crate? I've been through a few now and picked up Anyhow from the wgpu tutorial.

I feel like this is how Result should work to begin with, just wrapping the return type because why should one fiddle with error types on trivial cases while <T, E> is still a separate extended option for more explicit handling. It still supports expect() while adding ensure(), an alternative to assert() that bubbles an error instead of plain-rear end panicking, something I've desperately needed as a final catch-all for accepting client inputs. I also like context() which is more about where things hosed up rather than what specific thing and is way more idiomatic than ThisError's attribute spam. bail() is funny for matching exactly how I used to make do ... while(false) blocks to 'bail out of' with a break in PHP.

All these ?'s make my code seem indecisive though...

Ranzear fucked around with this message at 23:14 on May 28, 2023

Ranzear
Jul 25, 2013

gonadic io posted:

I personally would comment it out and leave little note for when I came back to it.

Ranzear
Jul 25, 2013

Is there a way to alter the cargo new behavior to add some extra default crates and other toml changes or perhaps change "Hello world!" to "Sup fuckers!" for instance?

Just having the right dev-dependencies already set up for dynamic linking and whatnot would be killer. I don't really want to copy-paste all that into every Bevy project I start up. Seems like years ago it was hardcoded.

Adbot
ADBOT LOVES YOU

Ranzear
Jul 25, 2013

necrotic posted:

Whatever your starting point is, put that in a repo somewhere. Clone and push to a new origin for a new project.

Of particular interest is always getting the latest Bevy without resorting to too much version wildcarding that'll risk a major version bump. Say 14 comes out the day before I start a jam, I'd like to be on it without paying too much attention.


This seems like a much cleaner version of the same (absolutely non-)problem. I'll probably just wind up with some kind of script in the root of my projects folder.

Maaan even just some kind of default crates config would go pretty far but probably not fix what I don't like boilerplating so often. Feels like [dev-dependencies] and [build-dependencies] are deep dark esoteric magic from somewhere outside the regular flow and I'm still doing them by hand each time. I still need to go PR the cheatbook about using them instead of extra forgettable cargo arguments.

I'm basically just whining about having to copy-paste like 17 lines:

code:
[dev-dependencies]
bevy = { version = "0.13.2", features = ["mp3", "dynamic_linking", "file_watcher", "embedded_watcher"] }

[build-dependencies]
embed-resource = "2.4.2"

[profile.dev]
opt-level = 1

[profile.dev.package."*"]
opt-level = 3

[profile.release]
opt-level = 'z'
lto = true
codegen-units = 1
panic = 'abort'
strip = true

Ranzear fucked around with this message at 02:29 on Apr 23, 2024

  • 1
  • 2
  • 3
  • 4
  • 5
  • Post
  • Reply