3 ms·
completely not! (And yes, I was considering if I should shout in capslock ;) ) I have seen so many fresh starts in Rust that went great during week 1 and 2 an
by fxtentacle 2y ago
completely not!
(And yes, I was considering if I should shout in capslock ;) )
I have seen so many fresh starts in Rust that went great during week 1 and 2 and then they collided with the lifetime annotations and then things very quickly got very messy. Let's store a texture pointer created from an OpenGL context based on in-memory data into a HashMap...
impl<'tex,'gl,'data,'key> GlyphCache<'a> {
Yay? And then your hashmap .or_insert_with fails due to lifetime checks so you need a match on the hashmap entry and now you're doing the key search twice and performance is significantly worse than in C.
Or you need to add a library. In C that's #include and a -l linker flag. In Rust, you now need to work through this:
https://doc.rust-lang.org/cargo/reference/manifest.html https://doc.rust-lang.org/cargo/reference/manifest.html
to get a valid Cargo.toml. And make sure you don't name it cargo.toml, or stuff will randomly break.
- steveklabnik 2y agoYou don’t need to work through that, you can follow https://doc.rust-lang.org/cargo/reference/build-script-examples.html#linking-to-system-libraries https://doc.rust-lang.org/cargo/reference/build-script-examp... and it shows you how.
- uasi 2y agoAdding `foo = "*"` to Cargo.toml is as easy as adding `-l foo` to Makefile.
- kelnos 2y ago> Or you need to add a library. In C that's #include and a -l linker flag. In Rust, you now need to work through [link to cargo docs] This is just bizarre to me, the claim that dependency management is easier in C projects than in Rust. It is incredibly rare that adding a dependency to a C project is just an #include and -l flag away. What decent-sized project doesn't use autotools or cmake or meson or whatever? Adding a dependency to any of those build systems is more work than adding a single, short line to Cargo.toml. And even if you are just using a hand-crafted makefile (no thank you, for any kind of non-trivial, cross-platform project), how do you know that dependency is present on the system? You're basically just ignoring that problem and forcing your users to deal with it.