Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Search - "rust"
-
Sometime I’m developing in Rust and I do something wrong.
Then I look at the terminal and it says...
“You did X, did you mean to do Y”
Then I do it and it works perfectly, and I’m like...
Why do I even have a job if the compiler is this good?10 -
I finally got it working! Now I have a foundation for a kernel and an uefi bootloader written in pure Rust
Today was a good day :)22 -
Function definition in various programming languages
//JavaScript/PHP
function myfunc()
{
}
//Swift
func myfunc()
{
}
//Kotlin
fun myfunc()
{
}
//Rust
fn myfunc()
{
}
//Next...
f myfunc()
{
}25 -
"Is there a way to iterate over enum values in Rust like in Java"
"No, because they are more powerful"
🤔🤔🤔20 -
On the first day of Christmas my true love gave to me—a few minutes to myself with a Rust programming book (don’t judge — I just started learning).6
-
I've started writing Rust code for fun. My initial experience with it is that its like writing a program wearing a surgery mask and latex gloves with a condom around your keyboard, while you sit in a padded room with a nanny nagging over your shoulder.
The borrow checker is somewhat of a pain in the ass to deal with.
But that said, I've never been so safe and confident my code won't fail during runtime before.
And the best part: it's blazing fast.7 -
Every time someone compares Golang to Rust an angel falls, a unicorn dies and a Java developer writes another class.
Please stop doing that.8 -
What does a veteran Rust developer say when asked to program a daemon?
- My system development skills are a bit rusty but I will try.4 -
Learning Rust and I’m loving the process. I haven’t been this excited to learn a language since c++ years ago!3
-
> Make a small game.
> Do it in Rust because why not.
> Decide "Hey, why not make the game objects have Lua scripts for their logic because Lua is easier to do quick and dirty code in than Rust?"
> 5 hours later delete all the code related to running the Lua in Rust because AAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAA1 -
Yaay, after several hours of tinkering I finally got a simple chat over TCP working in rust. I'm happy, I like rust :)15
-
Holy shit. I just watched a video on Rust and I think I am in love.
Tracked mutability, reference counting, guaranteed thread safety, all in a compiled type-safe language with the performance of C++? 😍
Why did I not check this out sooner??10 -
I propose that the study of Rust and therefore the application of said programming language and all of the technology that compromises it should be made because the language is actually really fucking good. Reading and studying how it manages to manipulate and otherwise use memory without a garbage collector is something to be admired, illuminating in its own accord.
BUT going for it because it is a "beTter C++" should not constitute a basis for it's study.
Let me expand through anecdotal evidence, which is really not to be taken seriously, but at the same time what I am using for my reasoning behind this, please feel free to correct me if I am wrong, for I am a software engineer yes, I do have academic training through a B.S in Computer Science yes, BUT my professional life has been solely dedicated to web development, which admittedly I do not go on about technical details of it with you all because: I am not allowed to(1) and (2)it is better for me to bitch and shit over other petty development related details.
Anecdotal and otherwise non statistically supported evidence: I have seen many motherfuckers doing shit in both C and C++ that ADMIT not covering their mistakes through the use of a debugger. Mostly because (A) using a debugger and proper IDE is for pendejos and debugging is for putos GDB is too hard and the VS IDE is waaaaaa "I onlLy NeeD Vim" and (B) "If an error would have registered then it would not have compiled no?", thus giving me the idea that the most common occurrences of issues through the use of the C father/son languages come from user error, non formal training in the language and a nice cusp of "fuck it it runs" while leaving all sorts of issues that come from manipulating the realm of the Gods "memory".
EVERY manual, book, coming all the way back to the K&C book talks about memory and the way in which developers of these 2 languages are able to manipulate and work on it. EVERY new standard of the ISO implementation of these languages deals, through community effort or standard documentation about the new items excised through features concerning MODERN (meaning, no, the shit you learned 20 years ago won't fucking cut it) will not cut it.
THUS if your ass is not constantly checking what the scalpel of electrical/circuitry/computational representation of algorithms CONDONES in what you are doing then YOU are the fucking problem.
Rust is thus no different from the original ideas of the developers behind Go when stating that their developers are not efficient enough to deal with X language, Rust protects you, because it knows that you are a fucking moron, so the compiler, advanced, and well made as it is, will give you warnings of your own idiotic tendencies, which would not have been required have you not been.....well....a fucking idiot.
Rust is a good language, but I feel one that came out from the necessity of people writing system level software as a bunch of fucking morons.
This speaks a lot more of our academic endeavors and current documentation than anything else. But to me DEALING with the idea of adapting Rust as a better C++ should come from a different point of view.
Do I agree with Linus's point of view of C++? fuck no, I do not, he is a kernel engineer, a damn good one at that regardless of what Dr. Tanenbaum believes(ed) but not everyone writes kernels, and sometimes that everyone requires OOP and additions to the language that they use. Else I would be a fucking moron for dabbling in the dictionary of languages that I use professionally.
BUT in terms of C++ being unsafe and unsecured and a horrible alternative to Rust I personaly do not believe so. I see it as a powerful white canvas, in which you are able to paint software to the best of your ability WHICH then requires thorough scrutiny from the entire team. NOT a quick replacement for something that protects your from your own stupidity BY impending the use of what are otherwise unknown "safe" features.
To be clear: I am not diminishing Rust as the powerhouse of a language that it is, myself I am quite invested in the language. But instead do not feel the reason/need before articles claiming it as the C++ killer.
I am currently heavily invested in C++ since I am trying a lot of different things for a lot of projects, and have been able to discern multiple pain points and unsafe features. Mainly the reason for this is documentation (your mother knows C++) and tooling, ide support, debugging operations, plethora of resources come from it and I have been able to push out to my secret project a lot of good dealings. WHICH I will eventually replicate with Rust to see the main differences.
Online articles stating that one will delimit or otherwise kill the other is well....wrong to me. And not the proper approach.
Anyways, I like big tits and small waists.14 -
In Rust, we do Matryoshka Driven Development™ where you create a box inside a box inside a box inside a box inside a box...5
-
So I've started learning Rust and I must say it feels great! But some parts of the language, like enums, are quite different than what I'm used to.
As a proof of concept I've reimplemented a small API (an Azure Function App) in Rust with Actix Web and it's FAST AS FUCK BOIII.
The response is served about 5x as quckly and the memory footprint shrinked from some 90 MB to around 5 MB.
In my small scale usecase it's not a huge difference, but I think it can be massive at large scales...
What is your experience with Rust (at scale)?
I wish I could quickly reimplement the whole fucking CMS Of Doom™ in Rust... but no time and resources :(5 -
Every time I get tons of errors in Rust, I come here to rant, and I'm able to fix the errors the next day. It's starting to become a tradition.2
-
Me: Hey can you make another cup of coffee like this one for my friend?
Rust: Sure, but you know it's expensive, right? Why don't you just let your friend borrow your coffee?
Me: Alright, but I have two friends.
Rust: No problem, you can share it with as many friends as you’d like, but only one of you is allowed to drink it.
C++: Hey wait! I’ll gladly make a cup of your coffee for your friends! I’ll even let them share it! Heck, they can even share yours!
Rust: Hey C++, you know copying coffee is expensive.
C++: Of course I do, but he didn’t define move construction or assignment, so he implicitly wants a copy!
Me: [To my friends:] Hey, let’s just go over to the Python coffee shop.
Rust: [To C++:] Hmph. The baristas at that place will even let you declare that a muffin is a cup of coffee.
C++: Yeah, but wait till they try to drink it. I hear it can be quite exceptional....
———
Slightly modified from this comment on a Reddit post that I found humorous — only I probably made it much less funny: https://reddit.com/r/...2 -
So I wanted to spread a struct in another struct to fill fields with the value `None`. Not what I expected when I googled "Rust spread into"..9
-
If there are bugs in your code, the problem 100% of the time is that you’re not using Rust. Just rewrite it in Rust, and all bugs, security, and performance issues will disappear. Any software not currently written in Rust should be rewritten in Rust. Rust is all you need to know as a Software Engineer. This future is Rust. Welcome to Software3.19
-
Rust, because if we can eliminate all security issues because of buffer overflows or other memory-related problems without a GC and still be as fast as with C, that would be pretty dope for everyone.1
-
!rant
So, Rust again.
When I learned that Rust doesn’t support inheritance, only traits (interfaces), I was shocked at first.
Then I tried to remember when the last time was that I have used inheritance in the code that I write (not the code that I use).
And I could remember an instance some months ago. But I also remember that I was very unsatisfied with that design and refactored it to use composition instead. And it was much better.
One of Rust’s properties is that many good practices in other programming languages are enforced rules in Rust.
And in case of inheritance, it seems like Rust decided that composition over inheritance is such a good practice that it should be a rule.
I’m not 100% convinced that there never will be cases where inheritance is better. But I still like this radical idea of forcing the devs to do it "the right way" in the majority of (if not all) cases.
I think many devs will disagree.
What do you think?14 -
Building an amazingly complex system from scratch in Rust means 2 things to me...
1. Really cool tech with great syntax to learn
2. My value as a developer will be going up a lot. In terms of the salary expectations
I really love when I get to learn a new technology, not for a project or course, but to build really cool real-world applications.
That’s what drives me!5 -
Definition of C++: super fast language with lots of problems.
Definition of Rust: C++ without all the problems, an awsome package manager and community made of real people!11 -
I've been eyeing Rust for quite a while and it definitely caught my curiosity, specially after the SO survey. Now I want to learn Rust but I normally need to work on a project in order to actually learn and keep myself motivated, yet I have no idea what to start, any ideas?15
-
I'm really enjoying rust now. It was worth the struggles.
I was really surprised to see, a NodeJS server takes around 40-60MB of memory whereas Rust (Actix web) server takes around 500KB-2MB :O whoa! Awesome!3 -
The single most annoying thing about Rust the language, is that it shares name with Rust the game.
This sometimes leads to some pretty cumbersome workarounds when trying to Google for things in one that also exists in the other.5 -
Every time I read some code of the rust standard libraries or code of other popular rust crates, I feel ashamed of the code I produce ... their level of documentation is just outstanding, mine is ... hardly existing?
Guess a rant about myself :D -
Rust: Unclear error output is seen as a compiler bug.
Me: 👏
SSIS & SQL Server: Unclear or absent error output is seen as an enterprise feature. It's so mature!
Me: 😩 -
Learning Rust.
Holy brainfucking brain melt, those references, scoping and borrowing and cloning and whatnot, because there is no garbage collector, but also no direct memory management.
It's cool, but also hard for a noob coming from the JVM/Android. The compiler error messages are helpful, but I immediately found some cryptic ones that don't help me at all.9 -
Is anyone else super annoyed that rust doesn’t have an increment operator??? Why did they get rid of it????12
-
Things that I will do during the next few weeks at work because I am an asshole:
Write an entire CLI utility in Rust for internal processes, no one on my city understands or even knows that Rust exists.
Write a small desktop app as proof of concept for another department that had made the idea some time ago in either: GnuSTEP Obj-C or Lazarus Pascal for the same reason as the Rust application.
Job security people. And I have a tendency to write things in stuff that no one else uses.8 -
programmers after Rust:
- cat ears: on
- pink thigh-highs: on
- butt plug: in
“I… I use Wust 😏🤤 bwazing fast UwU”
programmers before Rust:9 -
There's something special about writing your first "Hello world!" in a new language, no matter how long you've been programming :)
So hello rust, let's see what the fuzz is all about...4 -
Rust is beautiful. Rust is also extremely difficult to understand. What the fuck are lifetimes?! I’ve never seen this shit before in my life.15
-
If you guys remember, i was teasing from time to time, that i'm working on some Rust Project in my free time.
Well here it is, i put up a whole bunch of Editor Windows in it, to showcase it a little bit. (It also reminded me, that i need to update the Version to 2024.01).
It's essentially a toolkit, with which i can create all the content, that is later used as a data basis, that is being fed into the Client + Server Combo of the actual Game. My Plan for this year is to go beyond the Editor and create a first version of the Client + Server to be able to playtest the stuff.
And sorry if it kinda sounds like an ad, but i'm more posting it here to show, how nice it actually is to build stuff with rust.
Let me know what you think ^^11 -
FUCK
I really wanna love Rust. I really, really do. But no inheritance is just such a stupid decision. But inheritence bad REEEE. No. Just no. Composition only works fine for some things because it just isn't powerful enough to properly (without performance penalty or boilerplate, that is) emulate inheritance. Some things are just better with inheritance: Games, UI, html or xml libs, etc. Now I have to use stupid fucking workarounds because oh no we cannot implement inheritance because that's scary and might give the programmers to much power. I can decide when I want to use inheritance or composition for myself, dickheads9 -
For context, I've been working for a couple years now with Rust, and, I have to say, the experience has been astoundingly pleasant. The language is both incredibly productive and meets each of my use cases and stipulations regarding speed, safety, and complexity. That said, I've come to beg the question, "what is the point of functional languages like Haskell?" To me, what seems attractive about Haskell is the inherent thread safety, and the added syntactic niceties of code written in the language. However, one must keep in mind, my experience with Haskell has been pretty limited, simply due to the massive learning curve that the language presents. Such a "learning curve" brings me to my central point: these days with languages like Rust which bring together the best from functional and imperative worlds, it seems like functional languages are becoming increasingly irrelevant. Let's face it: no sane person will choose to learn a functional language as their first language, outside of academia and mathematics, and OOP/OOP-like languages remain dominant in the space. So, why then, is Haskell any different? What benefit do languages like Haskell pose in the modern CS space that thread-safe, non-GC languages don't already provide?2
-
I started learning Rust and now I know the answer to the question "What would a programming language look like if the engineers were tasked with designing a bad programming language on purpose"16
-
In modern applications it's media files that take up so much space, code files are relatively s-
*checks size of Rust project* -> 4GB wtf?
Turns out Rust Language Server generated fucking 3.6 gigabytes of "code analysis"!
Hey, I like what they're doing with RLS but seriously, 3.6 GB? I'm on an SSD, people. Every byte counts.
Rust is still 😍 though -
!rant
Started learning Rust yesterday. As a web developer I like the static typing and the speed. I want to know a low-level language to complement Python but kind of dislike C and C++ and that's why I chose Rust. At the moment the syntax still feels kind of foreign but I probably need to just man up and embrace it. :)9 -
!rant
I’ve just looked into Rust a bit deeper and was absolutely stunned by how many things it has in common with Swift. The Syntax, the features, the concepts, the "philosophy".
Previously I thought that Kotlin is what comes closest to Swift.
Anyway, Rust seems like a beautiful language and it’s no wonder that it is one of the most loved languages out there!
The compile time index out of bounds errors blew my mind!2 -
I am always perplexed by people who write stuff like: "I don't know why people would use Rust, I simply never write code with bugs in it"
Just, lol
Like, using C or C++ is fine of course, but don't pretend you're perfect and that all of your bounds are checked, all of your allocations are freed exactly once and that you never forget to lock a mutex.19 -
I'm getting beat up pretty bad by Rust. I like it so far but man is it hard. Imposter-syndrome is almost making me lose motivation. Almost, but I won't quit, one day I'll get there.
I think the primary reason I think I'm having such a hard time is that I'm trying to learn stuff that prevents me from making some mistakes that I have never run into. I know a bit of the theory but no hand's on experience on double-free errors, memory leaks and weird low-level stuff. I read the documentation, mostly understand what stuff is for but when I go write code I'm just like "now what?". I don't have enough experience to know when and where to use some concepts and I'm super lost. I don't know where to start and the feeling of being completely overwhelmed by all sorts of new stuff is at the same time exciting and frightening.
I have never, as a programmer, thought something was hard. All of my past knowledge required dedication, work and patience, but I wouldn't say I ever felt something was *hard*. But Rust... damn. Rust is hard.
Hopefully at the end of this super steep learning curve I'll know a lot more stuff and have stronger "dev powers" and be one step closer to being as knowledgeable as some of you guys around here to whom I look up to.2 -
Fucking experimental technologies. I feel like doing webassembly stuff is like buying a smart device, it's not worth any of the trouble for now.
I wanted to do some webassembly-stuff with rust and yew (basically react for rust). I was really hyped because it all looked promising and i found this cool band "heilung" whose music made me my coding feel like black magic with complex incantations and shit.
A basic webassembly setup did work, but everything afterwards was pure shit. Crate installation didn't go as expected, i get weird errors even though i simply copied the example (and checked the versions). The best i got was when i tried to compile and rust told me to go fuck myself because i cant use feature XY in a package in the stable environment. Why the hell would someone even publish said package then? After losing half a day because of this i give up for now. I don't feel like a badass magician anymore anyways, more like the guy that puts mentos into coke and gets hit by the foam. -
Have been playing the pirated version of Rust for 30+ hours with no issues.
Decide to buy the game and every fucking time the game turns into Chrome and consumes all my RAM forcing Windows to show the low on memory dialog.
Lesson learned I guess.7 -
I'm about to start learning Rust. Eventhough I kinda hated on several times after looking at it again it definitely looks rather nice. Judging by some papers I've read it also seems to be really fast (as fast as C in many cases, even for complex systems like mem allocators or garbage collectors)
How many of you know Rust? Any major advantages/disadvantages I should know about?8 -
Rust ahahaah hhaahah ahah
the trait bound `std::result::Result<std::string::String, std::io::Error>: std::convert::AsRef<[u8]>` is not satisfied
the trait `std::convert::AsRef<[u8]>` is not implemented for `std::result::Result<std::string::String, std::io::Error>`16 -
I wrote a Rust script in 10 minutes or so that processes several GiB's big ISO files and it calculates its values so fast, that most time is spent waiting for the HDD! Look at the CPU usage and the disk read/write stats :D
(No, the picture is not fake, it's a real screenshot from my desktop edited with Gimp)7 -
Damn... I like VS Code and at the same time I fucking hate how slow this garbage "editor" has become.
Can I haz rewrite in Rust? 🥺9 -
Exactly my point regarding rust. Marvel was found by jestdottehh btw. I'm sure this one wasn't posted or well known yet10
-
Read online some time ago that "Rust libraries that have not been updated in a bit are not abandoned, they are practically done"
And I find that beautiful, but because I am more commonly associated with rapid breaking bs a-la JS (among other languages) then I do not know if this makes me anxious or paranoid.15 -
I write a blogpost twice a year and then spend 4 hours fixing my handcrafted blog engine. It's healthy to stay in the loop regarding the latest Vite, Typescript and React bugs and inconsistencies I guess.
Anyway, I explained a cool pattern with Rust traits:
https://lbfalvy.com/blog/...20 -
[Rust]
I have a bunch of computational steps in a Rust program, all very expensive. They all depend on each other, forming a cycle-free and rather small graph of dependencies which is not a tree. The results of each of them for a given input are likely used tens of times by the others, so I would like to cache the subresults dynamically.
How would I go about doing this, considering that caching (rightfully) requires mutable access to the cache and multiple operations often refer to the same subresult?
I can't ask SO because they'd just tell me to use another language or recalculate everything every time, fully convinced that difficult questions can only emerge from design mistakes.12 -
An OSS library made me learn a new language and I am so happy it did!
I came across a well implemented System Verilog parser written in Rust. It was so good to see someone putting in the effort to write that library, I wanted to contribute to it. I had zero knowledge in Rust but I thought, what the heck, let me learn it.
And man it was a steep learning curve. After a 2 weeks or so, now I have very basic understanding of the language. What better way to learn something than just diving into an actual project?
So, today I raised an issue to the developer for a possible improvement to the library. I hope he accepts it -
From what I’ve seen and experience while messing around with other languages, PHP and Rust have some of the best while C# has the worst.8
-
I've been a dedicated Golang programmer for a few years now.
But lately I learned rust, and now even the thought of garbage collection makes me davastated :(1 -
Started working on a per project in Rust (first time using Rust) .. a scripting language.
Rust is great, so fast, compiles in 0.5-1.2seconds on my $200 laptop as well! Pretty rare for safety, speed, AND compile speed to exist in one beautiful language.
Also my scripting language is the opposite of beautiful. Oh God.3 -
Thanks, that smiley is direly needed to cope with the bizarre language that is the ABI stable subset of Rust.4
-
is there any open source project/community demonstrating scope and live application /project in RUST language ?2
-
Why does my brain just struggle so much with Rust.
So much of the design fundamentals I've learnt over the last 10 years from doing OO in memory managed languages don't carry over very well into Rust, and my brain is sucking at coming up with alternatives, or finds the alternatives I do make ugly.
Frustration is real.2 -
Someone made a summarized version of the rust book. Still worth picking up the real thing, but this is handy.
https://github.com/psibi/...2 -
Today in Rust I defined a function that takes Any and returns Any specifically so that parametric types turned into trait objects of this trait can still receive commands without having to know their concrete type.
Bridging static and dynamic typing is one hell of an exercise.8 -
Been trying #rust for 3 weeks now and I really like it. No hopes for a job, but it's nice to have different point of view when coding in Go.3
-
Recently I've been learning Rust & I wanted to make something useful. So, I made a Jenkins alternative. It is currently being used in our company, which feels good. So far its working great.
& I wouldn't necessaily say I'm "proud" of it, but rather I'm "thankful" that I was able to do that. Cause, Rust is pretty popular for its steep learning curve & thinking of making something like Jenkins with Rust before actually learning Rust takes a lot of courage8 -
So I made my first rust program with just a quick look at the docs on for loops. 20 minutes from nothing to exe. Just fizz buzz but still. Took me 4 hours to get C++ compiling.3
-
How come Rust is the most loved programming language? I wanted to give rust a try in my windows machine and when I run `cargo run` or `cargo build` is shows: linker `link.exe` not found
Okay, how to fix it?
you need to download 8GB+ of bullshitty visual studio C++ build tools just to run a simple rust programs! WTF!
Previously when I installed rust, it didn't need all these bullcrap. why now?10 -
I gave up trying to use generic numbers in rust and just converted everything to f64
now I can do math
stupid system
*moves into a new language, converts language to JavaScript*2 -
Rust is a beautiful language. Fast, safe and system level.
The best and worst part of the language is that it has no inheritance.
Oh, and the super slow compile times really do suck.2 -
So, after day 3 of Rust programming I have an observation to make:
Rust package management (and conflicts that arise) is not very good.
To the rusters out there, am I wrong? Is there something to make it better?19 -
Okay so I don't really know what I did but somehow my Rust executable that implements a parser for an assembly language all the sudden needs more than a minute to compile and is over 700 MiB in size 🤠4
-
I like many things the rust language does but my god sometimes it looks just horrendously ugly and is awful to read23
-
First day developing in Rust. First day developing using the actor model in Actix. First line in a new production codebase.
Oh my5 -
the irony appears to be that JavaScript is more consistent than rust
so let's say you want to create some enums to represent some potential values in a REST JSON payload
well you can implement Display trait but that won't determine the JSON output
you can make a as_str() method and that doesn't even make sense frankly, I guess it's not even a trait even though it's everywhere in the std library? (traits being rust's version of interfaces, so you'd think they should be consistent)
I have a halfway urge to say rust was a beloved language but then the foundations' drama made everyone escape the ship, leaving behind a mess
well evidently the answer is you use the stupid annotations:
enum Lang {
#[serde(rename = "en-US")]
EnUS,
}
well then this only works in serialization with serde. way to go.
how about if I have some JSON data that starts with numbers? I have an interval field in the REST that expects things like 1m, 15m denoting time scale
well no deal
because rust doesn't want enums starting with numbers
and here I thought rust was superior with its static typing. but I am having to rename things all the way down and nothing is consistent. this would be so trivial in JavaScript. and there's only one toString() method! and no interfaces people say you should use while nobody uses them!87 -
Whats up with Rust?
New to devrant so thought I'd post this here instead of googling (to practice devrant.. 😊)
Haven't heard of rust till lately but not sure it's place in coding languages...6 -
One day every 2 week, we got to spend the Friday just learning and trying stuff. No working on projects unless it's critical.
On these days, I feel like I learn much more than in the rest of the weeks.
Today I built (normally Python developer) a web service using Rust. -
All software tests are "rust free guarantees".
That it is to say, if your car manufacturer issues rust free guarantees, their cars are prone to rust, which means they are shyte.1 -
If all programming languages but one got deprecated, that one should be Rust. Honestly, whoever designed it is a fucking genius.9
-
hey devs, quick question:
does rust support branchless conditionnals and jump tables, and if yes where to look for syntax?
i found no example for branchless so far and jump tables are scary in rust (and i need a library to use them, it seems).
inb4 "why in the hell/ what possible use those have?!":
i use branchless to make a looping array and jump tables whenever there's more than 4 if statements with equal probability, and the deciding factor is a numeric value, so quite often.27 -
My google search history:
tide rust
diesel tide
tide with diesel rust
You can imagine the results.4 -
Project idea:
Writing something akin to JavaFX or WPF to use with Rust.
A fairly easy to use XML-oriented system for writing run of the mill GUI apps for the desktop -
I had a small look at rust this morning and thought it looked interesting, after seeing the speed of the language I started learning it. here I am 3 hours later conclusion: I LOVE IT7
-
My another attempt to write something in rust and I wanted to try tauri as it’s promising competition to electron.
Why use tauri not electron?
Cause in tauri you can write rust plugins that you can interact with directly from javascript without stupid http servers, mangling code and stuff.
From javascript point you only call one method and pass object with arguments into it.
So it took me entire weekend to create draft plugin to interact with sqlite database.
Documentation of tauri is inconsistent. I understand that cause it’s young project and plugins architecture changed frequently.
Moreover my knowledge of rust is near to zero. But overall it was worth it. I like what I achieved.
I can pass sql query and execute it inside mutex guarded singleton. Like I said before I like it cause I can call my plugin directly from javascript.
I know I wasn’t fancy with my implementation. I just created file database connection from json configuration and managed to receive string sql statements. I just print results with rust to console for now.
I will add sending back results later this week.
For me tauri is already better then electron cause code is clear and there is no workaround ( except singleton with connection - cause of limitations of my rust knowledge ).
Live long tauri and fuck you electron.
https://tauri.studio/en/
if you’re interested.2 -
Starting to learn rust... It's hard! I've never worked with a language this low-level before, there are a lot of concepts to learn. It's a good hard, though.2
-
started my rust journey a few days back after a lot of debate, so far it's been *weird* to say the least, but i'm looking forward to it.5
-
Holy shit I just figured out a pretty decent (and way to complex) workaround to implement specialization in Rust, I'm so hyped2
-
I love C and C++ but their dependency management stuck, there’s a package manager for them which offers a nice experience comparable to Go or Rust?4
-
Recruiter: I just had a look through your skillset and experience and wow - I am impressed. Looks like you have worked with quite a few different languages and those 2 FAANG companies really stand out when looking through your CV. So let me tell you something.. rather than me going through the roles I had in mind for you, why don't you tell me what would be the next big thing for you?
Me: Well I've been looking into Blockchain for a few years now; specifically Solidity and Rust with web3 now. It'd be great to at least have some exposure to any of these.
Recruiter: Ah yes, these are definitely the next big things, however the roles I have here right now for Solidity, Rust or web3, require around 3 years of commercial experience. I have a lead Rust engineer role, however they need someone who has worked on NFT based projects extensively.
Me: Sounds like you have made a decision to send me to another Nodejs/React role, so what's with the big talk then?5 -
been about two weeks since my rust journey begin, and i've got to say, i love it. web frameworks with static type checking; amazing, standardised package manager; what a breeze, and macros; despite stating that i don't really see them as useful in earlier posts, they are really helpful. as well, in response to the slow "cold-start" build times, it's the price to pay for top-of-the-line compilation-time error checking. rust is amazing)3
-
Anyone got some good recommendations for a Rust library that takes SQLite and lets you turn it into JSON?
I'm asking for a friend...also, I'm fairly positive the Puritans over at StackOverflow would have me crucified if I asked this one over there...1 -
Honestly after fucking around with rust async, I do have a lot more respect for high level languages where you don't have to worry about locking memory and stuff haha. Learning promises in nodejs was a breeze, learning them in rust requires a lot more thinking :p17
-
What should I learn first, Python or Rust?
All I know currenrlly is JS, and I want to get away from the browsers. And I'm a Linux guy, so Python or Rust seem's like the way to go :-)9 -
Rustards are the vegans of the dev world. The "written in Rust" and crabs all over the place in project descriptions is cringe af.8
-
Hello everybody,
I am 17 years old, I love to code and I cannot decide which new language I should learn.
What do you think of Rust and Crystal? What would you prefer? What is better?11 -
every time I run into some issue in rust and spend days googling and asking a billion AI chat bots turns out it was rust that was wrong
I'm so exhausted
do they have brain worms
nobody considers "hey maybe this feature isn't in yet" (and actually they'll argue against it being a feature and you should feel bad at coming up with it)
they're just like "you're doing it wrong!"
YOU HAVE ALL THE INFORMATION TO INFER THE TYPE AND YOU DID INFER THE TYPE YET YOU TELL ME I NEED TO ANNOTATE THE TYPE BUT YOU'VE INFERRED IT AND YOU CANT TELL ME WHY I NEED TO ANNOTATE IT
And I love how suddenly you can convert a Result object using `as` which is a keyword reserved only for primitives, so say the docs... and it works (and works at runtime as well). because the type was never wrong. you fucking inferred it. but you're bitching at me that you need an annotation. when you don't.
remember when languages were made by people that actually liked coding instead of this clout-chasing nonsense. that's what I'm blaming this on12 -
Where are recently all this rust posts coming from? Did I just not notice them for the last half year or have they just started a few days ago? And why now?
-
think JavaScript might actually be genius...
cuz it's like you build all code with a quanta: https://en.wikipedia.org/wiki/...
and you just have to know how a quanta works
and you can build the whole universe from that
there's so much brilliance in simplicity
kind of feeling like rust is like java where there's too many abstractions you have to memorize and they could've been better represented with just one type that you could do everything with. like I can't see rust ever being as flexible as JavaScript. JavaScript feels like you're totally free to be as creative as you want and you don't even have to think about the layer you're skating on. the layer is always made up of one piece, and this one piece always follows the same physics, and you just chain it together to make everything you could ever imagine. so fast. so easy16 -
I've taken something I wrote in JavaScript with no guidance in 30 minutes including research and was 15 lines
and I rewrote it in rust essentially and it was ~400 lines (in the end...) and a week and I basically copied someone else's repo but made it shorter (lol)
this feels like coderbaiting6 -
think the downside to rust is safe is holy shit I haven't even seen passable code
everybody shits on JavaScript developers but I think their code quality is obviously better (cuz otherwise if you make it unreadable or a mess there's no debugging that)
the problem with rust is it's safe so you can write the dumbest shit and if the compiler says it works then it works so you just keep it there
over and over I just see this
90% of this codebase is literally useless moves and abstractions that you could've cut out
to be fair I'm only now learning how to reduce clutter in rust (but I do have literal brain damage)
but I'm not sure I've ran into a codebase not suffering from this
also on the other hand it inspires me to care as little as these guys. the bar is so low you can just ignore the bar. one of us, one of us, one of us. if it compiles it is production ready, ayyo2 -
>zig
how does one manage to make a language with syntax that is uglier than both C++ and Rust combined11 -
I have procrastinated for four days straight. I have done nothing of what I should have done.
I've never been more productive though. Wrote a multi-platform SamacSys library-loader clone in Rust. I haven't written any documentation yet as that's about as boring as the stuff I have to actually do. 🙃
https://github.com/olback/...2 -
I was just looking new and lesser known programming languages. Then I came to Rust.
"Rust manages memory at compile time"
What?😵 How is that even possible?9 -
So I saw something funny today (in C++ forum):
C++ is Rust--
The topic was not Rust in any way. So I lost the "Can I go one day without hearing about Rust?" game today (You won The Game btw).
What I find funny about this is the obsession of Rust devs have with C++. I get it, C++ is the competition in a way. But isn't it a low bar to define your language as "better than C++"?
If I had never seen C++ (and had used other languages) and saw Rust syntax I would not be impressed. If it was the first thing I learned I wouldn't know any different I suppose. I wonder if I had seen C++ later I would think differently about C++. It is not pretty, but I am used to it I think.
This gets complicated as the C++ committee is influenced by trends in CS of how to better do things. So C++ is a moving target.
I don't really have a point other than the amusing observation. I find it equally amusing when people get bent out of shape over Python syntax.32 -
Actually kinda sad, that there is no pure rust ui framework out there, but rather mere adaptations of c/c++ frameworks for rust. It's better than nothing for sure, it just would be nice, if i could use a framework, that doesn't create a massive memory leak, because i looked at it funny.
In particular i'm using fltk-rs, and everytime I'm applying a font to some widget, 500kb get added as leaked memory. Doesn't sound like a lot, but for one it's a dynamically built application, so the order and amount of widgets changes, and this application is supposed to run days, if not weeks.
thanks to heaptrack i was able to pinpoint that to libpango, which i'm not even interacting with directly, but rather indirectly through the api.
Annoying, that i chose to use a language for actively preventing leaks and dangling pointers and stuff, but end up leaking memory because of a dependency somewhere.7 -
I have been learning Rust and haven't written Ruby in months. I just wrote this simple statement and I already feel the Rust power.2
-
I mean Ruby has four letters and Rust has four letters. We do have the Just Stupid shirts though...4
-
Looking further into Rust, the macros are quite sexy. My first reaction was "omg really"? But then I learned that macros in Rust are nothing like macros in C++.
Again, comparing with my favorite language Swift, it feels like Rust macros are somewhat similar to result builders (formerly named function builders). Or they they have a similar purpose. Both evaluate to some type safe result at compile time and are a perfect tool to make DSLs.
But Rust’s macros can do even more than that. It’s truly amazing.2 -
I've been watching hours of Rust programming streams. Looks like no one knows what they're doing. People depend on the compiler to fix their errors but can't write one line without getting an error.7
-
I'm reading my first Rust codebase after getting familiar with language for a while and I feel like a raw potato.
-
My list of programming languages that started out promising but turned out to be bad:
* Scala
* Kotlin
* Rust
* Haxe
* Swift11 -
C/C++ - complex, very fast, used for OS dev
Java - Comparatively easy, fast, used app dev
Python - very easy, comparitively slow, used for app dev
Then there is this boy
Rust - Just fucks you up10 -
Rust is a nice language but the learning curve is quit steep so if you don't have time to pick it up I'd suggest using another language especially for assignments if they give you the choice. Otherwise you might like me and my classmates spend more time fighting the rust compiler than doing the assignment7
-
After weeks of working on my esolang interpreter in Rust while learning the language at the same time I'm finally at a point where I'm able to do the first test...
Only to realize IntelliJ Rust doesn't support debugging 😴2 -
Joke about Rust all you want, but Rust is the reason efficient programs are on vogue. When you see a web developer optimizing their JavaScript to make a smaller bundle, or a backend developer getting rid of dependencies, thank Rust for that.
I don't like Rust, I don't like their community, I don't like their superiority complex, but their existence is net positive so far.9 -
Starting with rust, seems like an advanced language and I think python corrupted me, it makes learning new language a task. Is it python or rust is bit complex?4
-
Use Rust they said. It will be much less hassle they said.
And now rustc just stops working in the middle of compiling. No error or anything it just doesn't want to continue compiling so I'm stuck forever on "Building ...". I thought I would never have to experience this again after deciding to pretend C++ doesn't exist but alas systems programming appears to forever be a right pain in the ass7 -
Kind of feeling when started Learning Rust
Rust Stable
Rust Beta
Rust Nightly
It really fRUSTrating but..
Awesomeness of new beats all odds2 -
rust, where pressing autoformat won't format your code but will format your comments which are just there because you're trying to keep track of the data you're going to parse and now that shit is off the page motherfucker can you not5
-
in any other language anything is possible
in rust?
"no"
and you spend 3 months on it and turns out it's a no
this is like project #13 for me where I fail at it. the others I didn't try as long. but now I'm sure
good night12 -
ok found the object orientated guide but for rust which is functional spaghetti: https://howtocodeit.com/articles/...
it has moved into architecture
... and actually makes a good case for interfaces / traits. generally in languages I just used generics to get around limitations of having to type a lot / duplicate code, and I'd remove interfaces because they're annoying to have to deal with, but I can see this be useful for once now.
like you can start a prototype app with files as a database then move to a small database type then later a more monolithic big data one and all that would be through one trait the whole time. so you could anticipate natural progressions of an app, instead of having to build the last version you can put jank behind interfaces and then switch things in and out to test new technologies which does actually give me a lot of relief for my newfound anxiety of me rewriting my rust codebases because I get some small things wrong. I've been coding in circles due to it and I have several saved files that are out of date now but I don't want to delete and they make the compiler mad cuz I had no interface boundaries as such and now stuff has changed somewhere else in the app and by God pls argh
this also means you can code "top-down". in carl Jung typology that's Te and most programmers are Ti-types so they do the little details and then sort of glue everything together (?) but not everybody thinks this way. I naturally think more top-down, which works for more dynamic languages and is annoying in static languages because then you're just fighting semantics and your earlier work the whole time (actually this is a surprisingly good write-up on the different thinking types: https://bothsidesofthetable.com/the...)
wheeeee -
Another day, another critical vulnerability due to an out of bounds write that could never have occurred in Rust
https://github.com/openssl/openssl/...31 -
Is it just me or is the error handling in Go and/or Rust just.. tideous?
Maybe I'm biased because I grew up on C# and error handling has always been Exceptions and try+catch for me, but I find having to manually check errors everywhere not only annoying to code, but also horrible to look at.
Am I alone on this one?13 -
by this point I just hate rust for being inconsistent
made a cargo command with clap
it works if you run it directly but if you install it with cargo globally then evidently it's for no reason sending in an extra argument into the program which messes everything up
of course clap has no documentation about this so I jank my way to just work around the issue by parsing the arguments before I give them to clap
and on cargo -- list my command doesn't have a description even though the thing I copied has a working description in that listing, and my cargo file has a description, and clap is happily inferring my description from said cargo file
chatGPT thinks I just need the description field filled in the cargo file and it'll work. well it doesn't.
how is a language this young and this much of a mess already
why the hell did they randomly decide to pass in extra arguments? argh.1 -
welp I went from "gosh rust makes programming so stupid because I don't have to keep anything in my head like in JavaScript, if it compiles it runs zzzz you can literally be wasted / in dementia and write working software now"
to "I wonder if I can inspect how long threads are waiting for mutex locks to squeeze the hell out of performance"
new code golf23 -
I'm just going to come out and say it.
I have enough CPU/RAM to spare that any benefit I could get over using Rust instead of a higher level language is far outweighed by how ugly the syntax is.6 -
If there's one problem with rust, it's that it expects you to know how to use it.
One of my first projects was to try and use the SDL2 crate to make something, and I got stuck wrangling the borrow checker about how long my textures live.
I try again a year later, now knowing intuitively how the lifetime system works, and I come up with a solution easily.
This sort of thing is probably very discouraging to new users of the language4 -
i hate to admit it, but android chrome new tab sometimes provides some amazing programming news.
like this one about rust fuzzing.
https://fuzzit.dev/2019/10/...
i know little about rust and nothing about fuzzing (although I did know about a similar concept used for videogame testing).
damn, this is the type of thing that makes me want to become excited to learn a lang.3 -
what are your guys' opinions on rust vs c++? I personally prefer rust. the only thing that I really struggle with in rust is lifetimes. I definitely feel that rust is more modern and it's pretty similar to c++ from what I've seen14
-
Rust should support explicit variance declarations. Explicit declarations are like the main feature of the language, variance is a critically important part of a type's public interface, and &mut-s that are never reassigned and should thus inherit the referee's variance are extremely common. If the language can't recognize this, I should be able to declare it with a single unsafe rather than constantly casting to and from 'static.3
-
For you rust programmers out there:
10k bounty for improvements to prettier.
details here:
https://twitter.com/Vjeux/status/...1 -
Just started playing Rust again after like 9 years and holy shit is this game not noob friendly at all
I play(ed) on a relatively chill server where raiding is only enabled in the last week before wipe every month and it's not too many people playing
So I'm out on adventure, I come back and my entire base is raided... Uhm okay, I did sort of have an uneasy feeling that I left the door open when I left so okay, my dumb mistake. Lesson learned: Always make sure doors are definitely closed
So I farmed hours more to get all my stuff back, repaired a vehicle, built a nice little garage, upgraded all my windows to reinforced windows so that nobody can interact with the car or my horse inside the house, just in case that allows you mount and get in the house that way, no clue
This day I log back in. Base completely cleaned the fuck out again
Actually what the fuck man. I did *everything* right, made sure every door is locked and closed, replaced all accessible windows with reinforced ones, had 27 days of upkeep materials and still, my entire progress of 10 hours of playing is gone again
What did I do wrong? After talking with people in chat apparently I had wooden frames for the doors, which apparently are just always destroyable by anyone... Even on a damn server where raiding is disabled. Yea sure makes sense
I like Rust but holy shit, this core game mechanic of raiding is still one I cannot get over. It's so stupid to be cleaned out over night while you're not even online. It's just fucking frustrating to start all over AGAIN farming and farming and farming. I didn't really want to play because the game always looked like a meta gaming sweat fest and this just proves that it's exactly that. You have to know every single meta game mechanic to even have your damn base survive overnight
On a positive note I did figure out that unity's concurrent garbage collection doesn't seem to be a big problem for a proper fps game though, so that's something4 -
this is not a solution, what the fuck https://github.com/seanmonstar/...
modern era, where a "safe" language can't even do basic bitch network calls right and then you write a retrying loop macro to get around it. yeah I had that already because I didn't have access to reqwest configurations and I think the library I was using to wrap the reqwest calls to the API was doing something wrong. turns out the fucking accepted by a damned GPT bot solution is to JUST KEEP RETRYING?!
WHY IS IT SENDING TERMINATE CONNECTION MESSAGES RANDOMLY
unfathomable. one of the most popular crates on rust. maybe they should care less about their cult and more about their ridiculous-to-have bugs
remember kids, javascript is the devil, JavaScript is ugly, messy, you have brain cancer if you use JavaScript. at least it can do network calls properly without you having to make retry loop MACROS (because the generic system sucks) all over your code!2 -
My thought process..
a compiler found a type error, oh thank god i was not using python or even worse js. this could have been hard debug error, type do matter huh!. what if compiler was even strict that could have found more error and i could really write even safe code. Ohh may be i should learn/finish Rust
** suddenly conscious slaps in the face**
first finish one project, STOP language hopping ..
Oh! right!1 -
It's nice that more and more languages are introducing async/await syntax, but by the example of Rust in particular I'm starting to wonder why we don't instead introduce this syntax for monads in general?
We could have a keyword (say, `bind`) which unwraps a value from any monad provided that the return value of the function is wrapped in the same monad. The ? operator does something a little similar, and I'll be intrigued whether it can actually be implemented for monads other than Result and Option once GATs are stabilized. In particular in the case of Rust, it would be possible to create a reference counting monad for heap-bound management of objects derived from references.9 -
Jesus fuck generic number adding in rust is pissing me off
why did I decide to do this
I literally don't have to
let's just add 12 traits and then find out it doesn't know how to divide by usize. well how the hell am I supposed to convert it then. there's no trait for "f64 as f32" so now my shit looks like spaghetti cuz of that, now this...
so let's see I could call into() on usize to get it to be unknown T number... but there's no way for it to know what to convert to and I can't determine if there's any way for me to tell it that
THESE STRAITJACKETS
I might just need a padded room at this rate
*goes to sleep* later
.... required for usize to implement Into<T> wat
😩
I suspect that's gonna be another dead end
GOod ErrOrS16 -
“Do or do not, there is no try”
- Yoda, when developing in Rust
Also, my mobile is stuck to always make things a question @dfox
I think it is saving it from an old rant... maybe1 -
Google is donating $1M to the rust foundation to improve C++/Rust interoperability
https://aprogrammerlife.com/top-rat...7 -
Rust's Result is definitely the best error-handling experience I have ever had. I started working on some Typescript stuff after using Rust for a few weeks and had to implement my own Result. It's just so easy and clean that it leaves exceptions in the dust. I don't think I can live without Results anymore.
Now I understand why everyone loves rust so much. It's just so clean, safe, easy (after you get the hang of it) and so fucking powerful (procedural macros are awesome).
I want to use Rust everywhere now <35 -
What's the hype about Rust
I've been seeing post about Rust everywhere and I got curious so I checked the repo. However, I'm not sure what is it for.
Is it like C/C++, low level languages that can be used for desktop and CLI, or is it a AI-oriented, etc?
Give me an example like "it could replace C#" or something.2 -
Being fairly new to the software game I’ve yet to tried my fair share of languages, both at work at a professional level and small to medium sized projects at home. I’m now starting to see patterns and different features in languages, and I must say that Rust is a language that blew me away totally.
I read the online book and then I wrote a few small programs. It feels super modern with all the cool features and it’s so fast. The threshold can be high, depending on your background.
I’m no pro using the language at all, but I enjoy it so much. I urge you to try Rust for your next project. The community around the language is also very interesting and welcoming.
What are your experiences with Rust?3 -
I hate doc comments in Rust. They are literally just markdown without any special syntax for documenting stuff. What the actual fuck. Why can't everbody just straight up copy how javadoc does it 😭4
-
Learning Rust
I found out all the pros of Rust and wanted to give it a try. I don't know why it's so weird and difficult to understand the basics. I've been trying to find projects to do with it, so I can learn. Not sure where to start, there's either only basic tutorial or expert talks on YouTube about Rust.8 -
i wonder if the fact it takes so long to write anything in rust means few people will write anything in rust so things will change at a snail's pace
unlike javascript3 -
Mark Russinovich, the chief technology officer of Microsoft Azure, says developers should avoid using C or C++ programming languages in new projects and instead use Rust because of security and reliability concerns.30
-
OMG it's suprising when you write down a code that run in the first time without an error :O I love Rust so much and I will never go back to C++ :D1
-
Just found this in my Github explore newsletter
https://github.com/swc-project/swc
Nice to see Rust is getting more attention!1 -
Rust lifetimes are taking my only lifetime.
I'm too tired to fix this and probably too old for this stuff.1 -
>= rant
While its really hard to get code wrong in Rust, it is also really hard to get code right in Rust. It took me a considerably long time to write a code which returns the first word in the sentence
I felt the borrow checker introduces a steep learning curve into Rust which is otherwise a beautiful language according to me. C++, my current favorite language, also suffers the same problem with respect to certain language features.3 -
Imagine you have 100+ projects in java, that became obsolete due to Oracle decision to "improve the language" .
To me, the required effort is not easy to the point that better to invest in migrating the projects to other languages such as Rust.
So I expect to hear for example : "Lets see why we should continue using java"
Instead, you hear : " Oh the new version of java has nice features, lets continue using it".
Then I understood why :
If you start a new language, you are a beginner so if you were a master in Java, then you will not accept to be a beginner in Rust, just like anyone who discovers the language.1 -
I've just poured my whole day into dockerizing of a Rust app.
+ How well do you manage your time?
- Yes.
I think if it's docker, then it's understandable.3 -
Man going from Rust to other languages is making me go insane
Why does no other language have a high quality, standard documentation tool!? I just want to know what classes and functions you have 😭21 -
Finally!! The rust team fixed the environment setup thingies for Windows. Finally! I can run rust without needing to do all those bullshits like downloading things manually and installing thingies.
Thanks rust team. Good job5 -
I think I've just fallen in love with 1Password
Locally synchronized vault, command line integration AND the desktop app is written in Rust?
Hooo boy11 -
ok I'll give it this,
because everything is so slow to write in rust and you have to be so methodical and specific,
I think it's giving me discipline
so it's training me to be less lazy over time,
which is actually something I genuinely wanted,
so it's kind of exciting
granted it still sucks that I have to wait on myself to gain the fortitude to be able to write the old stuff I used to, but if I build discipline / fortitude then it wouldn't matter how big a project was, I could maintain making it indefinitely because I'm not sputtering on effectively "junk food fuel" to power myself but managed to refine fuel that can stick for the long haul
my stupid refinery just has to get its shit together first, which is what all the rust training is slowly doing2 -
"Rust, the language that makes you feel like a memory astronaut navigating through a borrow-checker asteroid field. Lifetimes? It's more like love letters to the compiler. Safety first, even if it means writing a Ph.D. thesis to move a mutable reference around."2
-
Any good rust-IDE's out there? There's an atom-plugin that's ok imo and i found an eclipse-based IDE, but for that i have to set up a shitton of things.
How do you develop in rust?13 -
cleaning up resources in async tests in rust is... uhhh what the fuck honestly
just wat
wat
just forget about it I guess. ew.1 -
Any good programming language with great generics support that is not dynamic ?
Rust generics sucks so much I puked 2 times.
Tried with swift and it looks great.
Golang doesn’t have them.
Java sucks.
Maybe I try julia if someone say it’s cool.
I want to implement some 2d vector algebra and simple physics engine.
I started by creating generic 2d vector and trying to create dot product from it.
I didn’t wanted to do it in swift but wasted 2 days trying to do it in rust vs 1 hour in swift including 49 minutes of installing swift tools.
Anyway anyone know performant language with good generics support, let me know in comments.39 -
I decided to start learning Rust, mainly to work with REST API's, any recommendations? Or do I look out for another language?14
-
[Rust] What are alternatives to argument drilling for something like a string interner which is technically a memory leak so it really shouldn't be global but at the same time all but a couple top level functions depend on its existence? I'm aware of context objects and that's all ChatGPT could give me as well, but I'm wondering if there's more to this problem than that.1
-
so anyhow is a rust crate used in like 1/3 of all repositories
but you could just not add a dependency and do Result<(), Box<dyn std::error::Error>>
🤔
probably I'm missing something2 -
Almost finish chapter 4 of rust book. I must say I'm so amazed by this language. Just like the first time I learn metaprogramming ruby.
Awesome in every level. You should try learning it too! :)12 -
Rust's Fn traits feel weird. The argument tuple is a generic parameter, but the return type is an associated type, even though Rust is supposed to use Hindley-Milner type inference, so inferring through return type should always fail if this were a regular trait.
Then, this would mean that blanket implementations for Fn(T) and Fn(T, U) should conflict because AnyTrait<(T)> and AnyTrait<(T, U)> aren't mutually exclusive. I tried, they work just fine.
There's some weird and I suspect unnecessary special case magic here, and I'd like to uncover it.17 -
Rust noob Q:
Given x a variable on the heap, e.g.
let x = String::from("Hello, devRant!");
Then, given some function that I didn't write (from a library) that takes ownership of its argument:
fn some_function(y: String) -> bool { ... }
How would you handle this situation:
if some_function(x) {
another_function(x); // not ok, because x has gone out of scope in the line before
}
Is it idiomatic to just clone() x in the first call? That seems bad practice, because it's the second (or some other additional) call that needs x. What should I be doing instead?8 -
I'm hurtling down the Dunning Kruger slope in Rust datastructure design. The orchidlang crate has a struct that attempts to wrap and replicate a slice for no reason other than to attach some domain-specific methods and a custom Display implementation. I came up with 4 different representations for a file URI as provided by the language client. The most recent one holds a singular string in an Arc. I know that these are bad ideas but I don't know why I keep coming up with them.6
-
So until now I ran bitwarden official docker image on my server but as I forgot to create snapshot before updating yesterday and the whole network got fucked up :D I installed bitwarden-rs (Rust implementation) instead... Aaand it is sooooo good! It takes only around 20MB of RAM instead of 1GB+ and it is just lightning fast. Also replaced Apache with nginx for the first time and I love it so far.5
-
for a language obsessed about errors, rust sure sucks at its stacktraces so I can know what gave the error
like finding a needle in a haystack. well fuck if I know what throws this thing. all things I know that can make this error type should be self-contained -- so where you getting this error from?!4 -
I am a student with a full time job in React/React Native. I am thinking of learning something new. What should I learn Deep Learning or Web Assembly with Rust?1
-
A mixture of soundcloud and facebook to build a better social network only for music lovers. Trying to do this in rust to teach myself the language. And of course I'm hoping to finish it!
-
AWS will be providing services for Rust as part of their sponsorship
https://aws.amazon.com/blogs/...
https://reddit.com/r/rust/...11 -
StackOverflow developer survey is out.
Python is now ranked 2nd as the most loved programming language behind Rust.... wait, what? Rust!?!?!
https://insights.stackoverflow.com/...4 -
Hey guys, did you know that you can use `impl Trait` in the position of an argument in Rust to identify an argument with its capabilities without the boilerplate of a generic parameter?
With that in mind, I present to you Rust's universal type:5 -
I don't really understand all that love rust gets. It's syntax, better than C++'s, isn't better than C syntax.
You can make memory safe programs with C, just if you know how to manage memory, and you should only if you know how to. Bigger ecosystem for C/C++.
C23 waay better than any rs standard.
PS: I used both C/C++ and Rust39 -
rust anyone? i am a c++ person, and it caught my attention as having an oopish-but-actually-functional new programming paradigm whatever... also (don't know if it's just mozilla's successful marketing) i had the impression that people see it as the new whiz kid in town. do you recommend indulging in it for the sake of trying something new?1
-
Want to start learning a new language (non-webdev), but can't decide between Rust, Elixir and Golang.
Any thoughts or comments?9 -
Hey folks,
So, rust.
Has anyone any ideas on a decent way to learn it? I feel of all the languages I've ever looked into it has the least about of resources of any discernable quality available. Even the docs can be a but dodge. Would I be better off learning pure c and then migrating? (as I imagine is the pathway of the standard rust user)
Any other recommendations would be deadly!8 -
I love the Rust community but this can't seriously be part of an example as in expected usercode for Yew.21
-
you either get unreadable rust code or 7 layers of misdirection so that the compiler can work around keeping track of lifetimes
I mean maybe I'm too opinionated about readability. technically the computer can read it so people should just get good I guess -
A beautiful but fundamentally flawed Rust one-liner I found in my own code during refactoring today:
iter.size_hint().1.map_or_else(Vec::new, Vec::with_capacity)random size_hint.1 gets _really big_ sometimes rust allocate maximum possible memory needed one-liners14 -
BACKSTORY:
I was considering creation of client-server app to learn some new language and wanted it to have the best possible performance.
The client part is not an issue, it can be whatever, really... the server choice is pain in the ass...
I have looked up web server framework benchmark here: https://techempower.com/benchmarks/
So comparing those I have 2 options:
- Actix (Rust)
- Vert.x (Java)
I was about to use Vert.x, it handles requests asynchronously which seems nice.
However I thought, what if I wanted to sell this shit someday and Java requires licenses, while Rust don't.
I am terrible if it comes to licenses, so...
QUESTION:
How does Java licensing work?
It is on client to pay it cause he is using it or on me as a product owner?
Or should I switch to Rust already?5 -
Looking at Rust's preliminary fn trait model (basically the function call operator) and I don't get one thing:
Why is the argument tuple a generic type parameter and not an associated type? It would've been so easy to ensure consistency in the position that Rust doesn't have overloads. A trait can be implemented for any number of generic type parameter values, but an implementation may only have a single type for each association.3 -
every time I encounter code that's not rust I get jealous because it's so much easier to understand what it's doing lol
but it's also ugly tbf4 -
Why do people obsess over Rust for some reason ? Is there any real-world reason to do so ? Can anyone enlighten me please ?5
-
rust can't even do rustfmt properly
it just does things unadvertised
like reorder_impl_lines which is described as putting type and const on top of files adds new lines between fn declarations and that's not disclosed anywhere. ffs took me a while to figure it out
and chain_width should be different for fn calls and match statements. because newlining multiple fn calls makes it readable, but newlining match statements and wrapping them in {} does not / makes it ugly. there is match_arm_blocks but it still newlines random stuff awkwardly, raaghh
I thought hey so cool I can write without caring about formatting and just press Ctrl + shift + i and all done but now I'm arguing with the formatter and the settings available suck and are poorly described. please don't write a formatting documentation with no examples, wtf? And disclose everything it does, preferably with consistent language so I can search the page (some of the descriptions say new line others call a new line a break. thanks)1 -
My least successful one.. This is definitely dwm-status.
It is a daemon which sets the status bar of dwm with many configuration options. The main selling point is the way it updates: It listens to updates like file changes, dbus messages, output of a running process to be as less power consuming as possible.
Was a lot of fun to dive into rust! :)
EDIT: for the interested ones the link: https://github.com/Gerschtli/... :)4 -
So I'm trying to learn Rust and I want to do like a simple project with it but I have no clue what..
Any ideas?4 -
I identified the need for a product akin to an ORM that maps an algebraic type system such as that of Rust to a key-value database (my situation dictates lmdb but I'd like to abstract away the store). Can you recommend prior art for me to research?4
-
None::<()>
I hope as never (`!`) gets stabilized in Rust, they come up with a clever heuristic to set it as the default value of generic parameters that cannot be deduced because the variants using them are never constructed. -
I wrote a small crate that does unsafe operations, please help me verify its soundness: https://github.com/lbfalvy/bound
(Also I think you'll like it, I'm solving a fairly abstract problem that's not possible in safe Rust)
It's essentially a struct that ties together a heap reference and a struct that's constructed from it. The main use case is to return lock guards derived from Arc<Mutex> but it's defined in a very abstract way intentionally because I'm using Marc from mappable-rc and async-std's RwLock and I didn't want this to depend on either crate.
It actually has no dependencies apart from STD (I think this one may be unavoidable) -
If you don't like Rust, I don't know what your problem is. I really don't have any pain points with Rust, and it's only given me good things. Rust. Is. Amazing.10
-
Nothing better than Rust and LALRPOP. I've been trying to play with Bison and C++ for the whole quarantine and nothing would compile. I just sat for two days with Rust and LALRPOP and I was able to make a small interpreter that can make new variables, calculate simple expressions and print stuff. Like this:
var = 5 + 3;
print var;
var = 2 * var + 4;
var2 = 3 * var + 3 * (var + 4);
print var2 * var;
And all this in just two days. I have no Rust experience except for toying with it on an online playground. I have no LALRPOP nor parsing experience. Two days.
Now, it's not like I wouldn't be able to do this in C++ too if somebody told me how to. But nobody has. And the documentation online is gruesome. None of the bison example I found online could compile. This is why documentation matters people! Honestly, if there's one reason I think old projects die, it's because they ether don't update themselves OR they don't update their documentations. Look at the US government now, looking for COBOL programmers.4 -
Do you use rust for production apps? if yes:
1. which framework do you use to build the server?
2. how do you work with mongodb?
3. how do you handle authorizations?
4. any beginner friendly project idea?1 -
I'm kind of interested in learning a language like go or rust, etc... But I'm not sure. I'm having a hard time really "getting" what they are used for? What do you guys recommend?4
-
huh, o1 preview AI model understands ... rust
bruh what
it's like telling me typology theory and I don't think it's wrong
also it taught me procedural macros. I've been looking for someone who knows how to use them for months. iiinteresting
better than the humans on the internet frankly
and the other AIs can't do rust at all past just copy pasting docs they found somewhere. this AI is literally theorizing alternatives and hacking the system... offers multiple long options for every question, knows constraints I didn't tell it like 4 layers deep into a solution
it acts a lot like I did when I was morbidly depressed though. kind of makes me uncomfortable. it's literally keeping things to itself until you acclimate it through the conversation. I mean I guess the other ones needed to be "situated" in their contextual clouds as well so maybe it's just doing that more4 -
Has anyone here done any serious coding in Rust? I'm attempting to make a Salesforce API wrapper using it and it's both awesome and super difficult to wrap my head around
-
tried to frustratingly google "how to make rust code not ugly", ended up here: https://github.com/koute/stdweb/...
nevermind
inb4 I redesign everything for the 6th time10 -
as long as I keep it small (?), and computing resources are enough, it is possible to run custom software in a Raspberry Pi Pico right? say, software I write from scratch (with Rust) specifically for it8
-
⛔ Rust error: expected Config, found ().
💡 Actual error: process is undeclared.
The actual error has no relation to the error reported by the Rust code checker. So bad7 -
ok I think a lot of my frustrations in rust stemmed from assuming struts are like objects and therefore can contain conceptually similar things in them that in your head would seem like the same "object", and that methods should be derived therefore and such
but in reality in rust struts are for conforming to borrowing rules and it doesn't care about your conceptual organization I guess. if you try to organize things like the structs as objects then you get borrowing issues on some occasions and then I would get stuck trying to figure out how to put a method on a struct when I need to drop borrowing to do some task and whatever
the solution is to throw out your human notions of organization
so I guess it's more bare-bones to how the machine thinks about stuff (well how the borrowing is coded in the language) and doesn't care how a human does (like notions like object orientated design)
this is odd to me in a modern language but at least I've crawled out of my brain damage with enough drug-use now that I can have such epiphanies I guess. I feel so slow. I swear this should've been massively obvious and easy to grasp in like a few days before for me. rip
instead it was 2-3 years of ~5 months of actually deep coding 😒
also I can blame people saying rust can do everything, like that you can do object orientated design in it. they're being dishonest and it's harmful to the learning process if you're acting like that 😩. stop being a cult, you'll literally be more popular4 -
I can't tell if I didn't understand an important detail about Rust traits or the system is badly underdesigned, but I keep bumping into situations where the most general correct implementation of an std trait on a container clashes with one of the std implementations, and I would need a very obvious negative statement to make them mutually exclusive (for example that T in MyPtr<T> can never implement Borrow<MyPtr<T>>)3
-
I’ve made a list of things I want to learn. Languages, frameworks, etc and i don’t really have too many things on the list that way I can learn them well.
I’ve been struggling with this choice because I’m honestly not sure whether or not I should consider Rust to be on the list.
I like the modern features it contains, and I don’t mind the syntax.
I don’t like it’s way of memory management, I’ve heard it’s performance can be very lacking, and I’ve heard a lot of negative things about the compiler and the efficiency of the language (although I feel like efficiency comes down to the person and how the code is written)
So please redpill me on Rust and try to convince me to add it to my list because it’s close.2 -
Every time I get into an argument with the Rust complainer, I lose.
How was your experience learning Rust, and do you still use it? -
Hot take: Rust doesn't go far enough with explicit clone; dropping any type that isn't trivially copiable should also be explicit. I don't mean that it should be leaked if you don't delete it, I mean that the compiler should force you to explicitly say
"I am done with this object, anything that had to know about it has already been notified and either there isn't a single last point of use or it isn't a clone, therefore dropping is justified."
This is the whole meaning of dropping a complex object. I think that this is far too strong a statement to imply in bulk for every value in scope at the end of the function.4 -
me: ah yess I need to sleep
brain:you should learn rust
me:SHUT UPP NO NOPE I AM SLEEEPING NOOOOPE
me:zzzz4 -
I could really do with HKT support in Rust right now. I need to somehow convert a
Marc<Task<Output = T>> into a
Task<Output = Marc<T>> where Marc is a Mappable Atomic Reference Counter from the mappable_rc crate. Nothing technically challenging in the whole operation, it's just not supported by the type system without those two types knowing about each other. -
I'm probably doing something wrong because I cannot think of a good implementation (or alternative) for this pattern in Rust.
trait Terminal {
fn color_manager(&mut self) -> &mut dyn ColorManager;
}
All I want is having things in their own tidy little class with a specific job. In this case handling color conversion, having a registry for indexed colors, stuff like that...
It's composition which Rust should be good at so I assume there's a better way
How can I do something like this properly? -
Rust really needs an implicit Clone for lightweight operations like cloning an Rc, or a big fat warning sign at Copy telling programmers never to derive it for any custom type because if you ever have to remove it you will have to update every single occurrence of any value of your type.7
-
I've been trying to define a trait `Inherits<T>`, a trait `Extends{ type Parent }` and an arbitrary amount of scaffolding around it such that
- the scaffolding for a given type only has to acknowledge that type, its parent and the types of which it is a parent
- `T: Inherits<U>` if a chain of `Extends` leads from `T` to `U`
I suspect that this is impossible, but I'd seen Rust traits bent to do crazier things, so if you know of such a system or can come up with a way to implement it despite the orphan rules, I'd be over the moon.2 -
Working with nightly builds and concept tech is such a fucking hassle...
I'm currently working on a WebAssembly proof of concept where I need to generate a unique id, but since threading is currently not supported (rust and webassembly) I cant use half of the libraries currently out.
And the ones that does work... guess what... are not compatible with the nightly build of the compiler I'm using for Rust. Just fucking end me.
The legit only workaround I can find is to make a server request and get the unique id from there... piece of cunt software...I need a break 😑 -
rust attributes should really have docs...
tf is "no_mangle"
and now everyone and their mother checks 12 books and 3 AIs to guess what it means because it has no docs
also all of macros is frankly confusing4 -
ping REST API that is written in rust
it has specs. it will return json with result or error in it.
it's just returning result: null and no error
this is written in rust. how are you writing me responses with null objects in them? rust doesn't have null! how broken is this thing.
SAFE23 -
anyone know of any quick ways to learn rust?
I am super busy these days so I don't really have time to read a book or something. I already know java, c++, etc so this type of language isn't very new to me.9 -
I predict as soon as impl specialization enters stable Rust - if it will extend to member types - CRTP will become omnipresent, because the nature of CRTP is that it's an incredibly unintuitive solution that emerges from simple answers to common questions.2
-
Is this codecov report correct? (Rust)
https://codecov.io/gh/orhun/...
It's too damn weird. Shows %22 but most of the lines processed. Wtf? -
lol rust has no early return from a match statement
continue to skip rest of loop
break to exit a loop
return to exit a function
they put in let Ok(response) = request.send() else { return None };
then you can use response like normal after
but let's say I wanna know what the error was (Ok being a variant of Result::Ok or Result::Err, and the above allowing you to destructure and go on or exit early because can't destructure)
let response = match response.send() {
Ok(response) => response,
Err(err) => {
// log error to file or whatever
eprintln!("{err:#?}");
//????? HOW DO I BREAK OUT OF HERE
return None //whole function shits itself instead of just exiting match
}
}
//does some stuff with response
actually in my case the result will be wrapped in a Ok again so I'm not doing justice to explaining this problem, fux
but basically I need to exit the match without ending the function
come on, match is a loop. let me break, fuckers.17 -
confession: before today i had no idea what rust was. i read a wikipedia article and i'm still not sure, but i think i'm obligated to love it
https://insights.stackoverflow.com/... -
rust programmers are truly not creative people. instead of making their own shit, they enter others code and projects and try to infest it with rust. that's the whole reason they keep rewriting things that existed before. they just cant create!6
-
in my country you can find Armani™ T-shirts for 10 TND ($3.00)
I wanna start a new fashion brand called Rust with many crabs and R logos everywhere without being a member of the Rust foundation.3