Fuck me sideways, Rust is so hard. Will we ever be friends?
#k7hrijq
#dtuk37a
(#k7hrijq) @lyse@lyse.isobeef.org :‘-(
#hiquusq
(#k7hrijq) @movq@www.uninformativ.de Hahaha 😂 This is gold! I’ve been following along with our ramblings on Rust. What’s it gone and done to you now? 🤔 I don’t think I can ever be friends personally, I feel “too stupid” to learn Rust 🤣
#zjsttwq
(#k7hrijq) @prologic@twtxt.net I’m trying to call some libc functions (because the Rust stdlib does not have an equivalent for getpeername()
, for example, so I don’t have a choice), so I have to do some FFI stuff and deal with raw pointers and all that, which is very gnarly in Rust – because you’re not supposed to do this. Things like that are trivial in C or even Assembler, but I have not yet understood what Rust does under the hood. How and when does it allocate or free memory … is the pointer that I get even still valid by the time I do the libc call? Stuff like that.
I hope that I eventually learn this over time … but I get slapped in the face at every step. It’s very frustrating and I’m always this 🤏 close to giving up (only to try again a year later).
Oh, yeah, yeah, I guess I could “just” use some 3rd party library for this. socket2 gets mentioned a lot in this context. But I don’t want to. I literally need one getpeername()
call during the lifetime of my program, I don’t even do the socket()
, bind()
, listen()
, accept()
dance, I already have a fully functional file descriptor. Using a library for that is total overkill and I’d rather do it myself. (And look at the version number: 0.5.10
. The library is 6 years old but they’re still saying: “Nah, we’re not 1.0 yet, we reserve the right to make breaking changes with every new release.” So many Rust libs are still unstable …)
… and I could go on and on and on … 🤣
#uiohq5a