#rustlang
Explore tagged Tumblr posts
itsjunetime · 7 months ago
Text
I made a little terminal-based PDF viewer! For fun, mostly, 'cause I thought it would be a fun challenge, but also a PDF viewer is the only other windowed program I currently use on my computer besides my browser and my terminal, so I thought it would be fun to replace.
It could still be more performant and handle its multi-threading stuff better (and I do have some ideas to do that), but I thought people here might get a kick out of this. It's built in rust, using ratatui, etc, you know the deal.
If you want to check it out, the code's here: https://github.com/itsjunetime/tdf
123 notes · View notes
daniel-nerd · 1 year ago
Text
got myself some thigh high socks that means my code will compile now! right?
Tumblr media
170 notes · View notes
zephiris · 2 years ago
Text
Java is a trash language that should burn in the parts of hell where hitler is
Rust on the other hand is a bratty lil language that should burn in the parts of hell where queers party
136 notes · View notes
somerandev · 2 months ago
Text
🫚 Day 35 of Game Dev for 🫱Teleport Man🫲
When the right hand is occupied, the left one punches instead of using the teleport ability.
Tried making the punch push objects... but...... i t h i n k i m e s s e d s o m e t h i n g u p
12 notes · View notes
bizarre-furry-bastard · 1 year ago
Text
Tumblr media
93 notes · View notes
youboirusty · 1 year ago
Text
Tumblr media
If your language doesn't have a yeet keyword what are you doing with your life
121 notes · View notes
voltradar · 8 months ago
Text
Tumblr media
Got my tights, skirt, heart choker, and hoodie. Anything else needed to complie my Rust?
22 notes · View notes
aeriavelocity · 1 year ago
Text
Rust is DOOM Eternal
Rust makes you want to learn functional programming just by the fact that variables are immutable by default - and if you want to pass a mutable variable through a function, good luck.
You have to declare "&mut variable" in not only the function call, but also the damn function signature.
Compare that to Python where variables can't even be immutable.
Of course - this is probably a good thing. I'm a devotee of functional programming myself, so I'm biased, but to be fair, I didn't even know what functional programming WAS before I learned Rust.
If C is the Dark Souls of programming, Rust is the DOOM Eternal. (and Python is the Garry's Mod)
56 notes · View notes
agapi-kalyptei · 11 months ago
Text
Not gonna lie. I wrote my first programs 34 years ago but I never was a "real" developer in the sense that I'd write fast desktop apps, manage threads, and all that low level stuff. So learning Rust in the past few months, even if I have some very basic experience with programming in assembly, is still a lot to digest. However, today I got back to my test project and am really hyped that I have.... a button that increments a number.
"Ha, I can do that in javascript in 10 minutes." I mean yeah. Obviously. Anyone can. Here's the cool thing tho. I made mine overly complicated.
The UI looks as you'd expect it to, mostly a starter project leftovers:
Tumblr media
The HTML is as simple as can be, just plain HTML and javascript, no compile step. We live in stone ages here and we love it.
Tumblr media
The submit button has a simple handler in javascript:
Tumblr media
This is, once again, trivial, and all just from the template project. Bottom part says "when a user clicks this button, call "greet" function". The top part is the greet function that invokes a Tauri command also called "greet".
What's Tauri? An open source project that lets you write JS/TS/Rust applications with WebView and bundle them as stand-alone, self-contained, one-file applications for desktop, and starting with Tauri 2.0 (now in beta.2) also for Android (and later iOS). If you know Electron (Slack, Spotify, Discord etc all use Electron, they're just websites with Chromium and C++ code packaged around them).
Anyway. Tauri runs a Rust "server" application that serves your HTML/JS app, but also lets you run high-performance Rust code. Adding a command is relatively simple:
Tumblr media
Here's where things get interesting. For me.
Because I wanted to learn Bevy, a game engine written in Rust, because I want to learn how to write using a high-performance functional-programming-like pattern called ECS (Entity Component System), I have added Bevy to this project.
However, both Tauri and Bevy block on the main thread, so I had to find a tutorial on how to spawn Bevy in a different thread, and how to pass information to it. An example:
Tumblr media
#[tauri::command] turns a normal function into a Tauri command that I can call from HTML/JS. It injects resource called BevyBridge which is just two lines of code: #[derive(Resource)] pub struct BevyBridge(pub Sender<u64>, pub Receiver<;u64>);
Sender and Receiver being from crossbeam-channel bevy crate which is for sending data back and forth safely and quickly between individual threads.
so "state.0.send(1)" means I'm sending a 64-bit unsigned integer with a value 1 to the channel.
Tumblr media
And this is how to receive the message - inside of Bevy engine, in a separate thread. For simplicity, if I send zero, it resets the counter, and if I send any number it adds 100000 to the number, just for clarity. (Elsewhere I'm incrementing it by 1 on every game loop, so theoretically 60x a second. Or 15000x a second because Bevy is unreasonably fast and it doesn't need to render anything in this setup.)
And the best part is that with a single command (cargo tauri build) I get an .msi file, an .exe installer, both around 4MB, and a 11MB .exe file with no dependencies besides WebView (installed on every current desktop OS by default). There's just something about giving someone a floppy disk with an executable that you made yourself.
Tumblr media
Is it dumb? Yes. Does it make me happy? No. Does it make me glad, and very relieved that I'm not completely lost? You bet.
27 notes · View notes
suntreehq · 2 months ago
Text
Learning Rust and using my Visuals app to get some autumn vibes. (Video sped up by 1.25x).
I was hoping bombarding my subconscious mind with autumnal images would help me deal with the change of season. But I get enough autumnal vibes just looking out the window so maybe I will change it up to sunny imagery.
7 notes · View notes
habble0 · 1 year ago
Text
Tumblr media
98 notes · View notes
itsjunetime · 5 months ago
Text
i built a little crate for tower-based rust web servers the other day, if anyone’s interested. it’s called tower-no-ai, and it adds a layer to your server which can redirect all “AI” scraping bots to a URL of your choice (such as a 10gb file that hetzner uses for speed testing - see below). here’s how you can use it:
Tumblr media
it also provides a function to serve a robots.txt file which will disallow all of these same bots from scraping your site (but obviously, it’s up to these bots to respect your robots.txt, which is why the redirect layer is more recommended). because it’s built for tower, it should work with all crates which support tower (such as axum, warp, tonic, etc.). there’s also an option to add a pseudo-random query parameter to the end of each redirect respond so that these bots (probably) won’t automatically cache the response of the url you redirect them to and instead just re-fetch it every time (to maximize time/resource wasting of these shitty bots).
you can view (and star, if you would so like :)) the repo here:
59 notes · View notes
forever-stuck-on-java-8 · 5 months ago
Text
hot take: most of the programs you guys are writing don't actually need the performance of rust. 80% of the time you can write the same application in a less complicated language in less time.
I say this because Operations has started a betting ring for how long cargo build takes for a rust web app that we inherited from an acquisition. Today it took 18 minutes.
17 notes · View notes
cerulity · 1 year ago
Text
The more you can recreate something in itself, the better it will usually turn out
Geometry Dash is a perfect example of giving a community many small tools to make great things. You can recreate the entirety of the main levels, and it stops far from there. Levels like WHAT, Limbo, Acheron, and many more are prime examples of the community using the tools to their fullest extent. From creating fully animated 3D effects, making the most unique memory level, to the outright hardest level in the game, all with top notch decoration, there's so much you can do.
Rust is also an example of recreatability. The compiler, standard library, and underlying low level implementations are all Rust. You can recreate a Vec with ease, simply using a Box<[T]> and a couple lines of unsafe code. Want to use low level AVX? SSE? AES? core::arch::x86_64 my friend. You can peek into the code if you really want to know what something is doing. Hell, it can even teach you about how things like atomics, reference counting, and deques work. Recreatability in Rust stops at intrinsics, which are added and implemented by the compiler (for good reason, being optimization and homogeneity), but all of them are available for you to use.
43 notes · View notes
somerandev · 1 month ago
Text
🤖 Day 45 of Game Dev for 🫱Teleport Man🫲
Lots of code refactoring and updating today. I haven't explicitly mentioned it, but the majority of my game is written using Rust using the GodotRust/gdext library (the rest is Haxe/shader lang stuff).
Today I decided to upgrade my codebase to the latest version of gdext that came out recently. It had tons of breaking changes, took hours to fix things, but ultimately very happy with how clean everything ended up.
Didn't realize how big my project had become until I was forced to go and fix things in every single source file. Feels like my game just started, but it's already so massive. Here's a little recording of my source file structure (editor is Zed).
I wish I could arted as much as I farted code out.
11 notes · View notes
utilitymonstermash · 4 months ago
Text
Something really rubs me the wrong way about rust and zig declaring Windows tier 1 targets. I guess they meet whatever criteria the projects use for tier 1.
But both these languages have large standard libraries full of Unixisms where it just seems much more common to hit Windows bugs.
Maybe it’s a sign of immaturity of the test suite, I don’t know. But I wish they were more upfront about not working as smoothly on Windows.
5 notes · View notes