r_rust🦀 – Telegram
r_rust🦀
62 subscribers
565 photos
65 videos
36.1K links
Posts top submissions from the rust subreddit every hour.

Powered by: @reddit2telegram
Chat: @r_channels
Download Telegram
My Rust Rewriting Journey

I replaced my C++ only Coding Journey with Rust

Like for example i have so far 2 Programs in C++ that i have both finished (well the second is still getting maintained so technically not finished yet lol)

but man does Rust feel so much better!

For my Non Game Dev Projects ive basically decided to switch from C++ to Rust and since its made such a Huge Jump in recent Years im very Proud to be Part of the Rust Community now!

https://redd.it/1pwmq8a
@r_rust
What is the current recommended way to install Emacs with Rust?

I searched for Rust and Emacs, and I found something that recommended installing rustic. When I tried installing rustic, Emacs told me that "rustic is unavailable". Now I find a post somewhere that tells me that rustic is obsolete and no longer maintained.

So, how do I get Emacs to work with Rust these days (and presumably with Rust Analyzer). I'm looking for something hands-on, like some lines to paste into my ~/.emacs, please.

No doubt, I'm not the first person to ask this, but I cannot find anything recent and actionable.

https://redd.it/1pwq1b7
@r_rust
pdfium-bind: easiest way to add PDF rendering in your Rust app

I got frustrated trying to figure out a way to ship Kiorg with PDFium embedded so its PDF preview feature can just work out of the box in all environments.

That experience resulted in **pdfium-bind**. A high-level pdfium binding that embeds a pre-built PDFium library into your application directly when static library is not available.

I hope some of you would find this useful as well.

https://redd.it/1pwryik
@r_rust
Small wordle project I made!

So I just started learning rust, and am just about to get to tests, but to consolidate everything that I have learnt so far, I decided to write a wordle clone! It includes colored text for each letter, accurate letter position guides (Green if correct, yellow if its in the word, with correct number of letters although there may be an issue with guessing something with letter pattern xxllx when the word has the pattern xxxlx (replace x with anything) as it checks in order, and would wrap the u8 I use round. There are of course solutions, but I can't think of one), both lowercse an upper case support, validation of it being in the alphabet and 5 letters long!
```rust
use std::{collections::HashMap, io};
use colored::*;

struct Guess {
word: String,
guess_info: ([char;5],HashMap<char,u8>)
}

impl Guess{
fn new() -> Guess{
let mut input = loop{
let mut input= String::new();
io::stdin().read_line(&mut input).expect("FAILED TO READ LINE!");
input = String::from(input.trim());
println!("{}",input);
if ! input.chars().all(char::is_alphabetic){
println!("Please only use letters in the english alphabet!");
continue;
}
if input.len() != 5{
println!("Please only use words of length 5!");
continue;
}
break input;
};
input = input.to_uppercase();
let guess_info = get_word_info(&input);
Guess { word: input, guess_info}
}

fn compare(&self, word:&str) -> [i32; 5]{
let word_info = get_word_info(&word);
let mut result = [0,0,0,0,0];
let mut word_char_count = word_info.1.clone();
if word_info.0 == self.guess_info.0{
result = [2,2,2,2,2];
}
else {
for i in 0..5{
let remaining_ref = word_char_count.get(&self.guess_info.0[i]);
let mut remaining: u8;
match remaining_ref{
Some(_t) => {
remaining = *remaining_ref.unwrap() as u8;
if remaining > 0{
if word_info.0[i] == self.guess_info.0[i]{
result[i] = 2;
} else{ result[i] = 1;}

remaining -= 1;
word_char_count.insert(self.guess_info.0[i], remaining);
} else{ result[i] = 0; }
},
None => {
result[i] = 0;
}
}
}
}

result

}

fn display(&self, result: [i32; 5]){
let mut display = ["".red(),"".red(),"".red(),"".red(),"".red()];
for i in 0..5{
let letter: &str = &self.word[i..i+1];
match result[i]{
2 => {display[i] = letter.green()},
1 => {display[i] = letter.yellow()},
_ => {display[i] = letter.red()}
}
}
println!("{}{}{}{}{}", display[0], display[1], display[2], display[3], display[4])
}
}
fn main() {
// init
const WORDS: [&str; 7] = ["HELLO","WORKS","TESTS","ADIEU","AUDIO","CRANE","PLANE"];
let word = WORDS[rand::random_range(0..WORDS.len())];

println!("----------WORDLE-----------");
println!("-----Terminal Edition------");

let mut win = false;
for _ in 0..6{
let guess = Guess::new();
let result = guess.compare(word);
guess.display(result);
if result == [2,2,2,2,2,]{
win = true;
break;
}
}

println!("---------GAME OVER---------");
if win{
println!("{}","You Win!".bright_cyan());
} else{
println!("{}","You Lose :(".red());
println!("The Word Was: {}",word.yellow())
}
println!("----------------------------")



}

fn get_word_info(word:&str) -> ([char;5], HashMap<char,u8>){
let mut chars = [' ',' ',' ',' ',' '];
let mut i = 0;
let mut chars_count: HashMap<char, u8> = HashMap::new();
for chara in word.chars(){
chars[i] = chara;
let char_count = chars_count.entry(chara).or_insert(0);
*char_count += 1;
i += 1;
}
(chars, chars_count)
}
```

This is the file and I am very happy with it for a first project with minimal docs usage (I used them to double check hashmaps, and I used SO for checking if its alphabetical). Any way I could improve (other than fixing that one issue, which for now I might just use i8, and just deal with the fact that players might think that there is an extra of a letter)

EDIT: switching to i8 does not change anything, IDK why I thought it would

https://redd.it/1pwsq9n
@r_rust
Built my first Rust project offline Markdown renderer for security documentation

I'm a developer who's been wanting to try Rust for ages. Finally got some time off this winter and decided to dive in.

**My learning approach:**

* Rustlings (got halfway through)
* Youtube tutorials and Rust Docs
* Building an actual tool – [Markdown Scribe](https://github.com/DhanushNehru/markdown-scribe)

I've always been a self learner

**Why I built this:**

In cybersec, I'm constantly writing documentation – vulnerability reports, penetration test findings, security advisories. I wanted a fast, offline-first Markdown tool that I could trust wouldn't leak my drafts to some cloud service. Something that runs locally, renders fast, and doesn't need 47 dependencies or an internet connection.

**What I loved about Rust:**

The biggest thing? **How easy it is to express intent in code.** Coming from Javanoscript and Python in the security world, Rust's type system and error handling forced me to think about edge cases I'd normally gloss over.

The strict error modeling taught me concepts I thought I already knew. For example, the distinction between `OsStr` and `str` – something that matters when you're dealing with file paths in security tools where encoding issues can be attack vectors.

**Zero-cost abstractions** are incredible. I built complex features without worrying about performance penalties. The compiler has your back.

**Developer tooling** is top-tier. Cargo makes dependency management painless, which is refreshing when you're used to dealing with security-critical libraries where supply chain attacks are a real concern.

Project is MIT licensed and open for contributions: [Markdown Scribe](https://github.com/DhanushNehru/markdown-scribe)
🌟 Star the repo - your support means a lot!

https://redd.it/1pwzjbk
@r_rust
Is Rust the future?

This is like 5th or 6th language I am learning, and I have to say I absolutely love it. It feels like the most complete, very well designed programming language. I love Rust, it is an absolute joy to write code.

However, coding is my side quest, my specialty is within cyber security mostly, and I don't really know much about current state and future. Would you say that Rust has a good future? Worth to learn fully?

https://redd.it/1px246m
@r_rust
influxdb-stream: A streaming client for InfluxDB 2.x - feedback welcome!

Hey r/rust!


I built a small crate called influxdb-stream. This is my first time publishing to crates.io, so any feedback would be appreciated.


Problem: Existing InfluxDB clients load entire query results into memory. When dealing with millions of rows (e.g., data migrations), this causes OOM issues.

Solution: This crate streams records one at a time with O(1) memory usage.


---

\- GitHub: https://github.com/almightychang/influxdb-stream
\- crates.io: https://crates.io/crates/influxdb-stream

---

Would love to hear any suggestions on API design, error handling, or anything else I could improve. Thanks!

https://redd.it/1px186u
@r_rust
Why won't this match statement compile?

The match statement has every possible combination of the bool match guard for 0 but still expects a 0 in one of the match arms.

See this example here

updated with correct rust playground

https://redd.it/1px4sds
@r_rust
upcoming Gust - a Rust based package manager that's up to 265x faster than swiftPM

https://preview.redd.it/qx3lkstgxs9g1.png?width=1800&format=png&auto=webp&s=90014391688272621d06e1ceef73c89d8fa636f5

Gust is a rapid, lightweight, open-source, Swift package manager, written in Rust.



It is upto 265x faster than SwiftPM and 10-12x faster than flutter's pub.



Gust uses a linking algorithm that ensures there is never more than 1 instance of the same version of a library on your machine, just like pnpm saving gigabytes of space in the long run.



Why would you be interested in Gust?



1. Massive Disk Space Savings
2. Rapid Package Installations
3. Lower CPU, RAM Usage
4. Significantly Lower Bandwidth Usage
5. Large Cost Savings



When will Gust be released?

I've been working hard to add new features and make Gust robust. Right now, Gust is in a very early stage so it is not ready for use, however, the key mechanisms that make it faster and more efficient have already been put in place and I have used it to rapidly make iOS, and watchOs apps with Claude Code and released them on the app store

The best part? Gust is open source https://github.com/quantbagel/gust! If you would like to support Gust development or find the project interesting, a would be hugely appreciated!

https://redd.it/1px76j4
@r_rust
This media is not supported in your browser
VIEW IN TELEGRAM
[Media] Looking for feedback on seekr, a GTK4 search launcher I wrote in Rust
https://redd.it/1pxmwrb
@r_rust
How stable do you think the WASM ecosystem is going to be?

Say WASM develops into what people hope:

\- people could use Rust and other languages and frameworks instead of Javanoscript, HTTP and CSS

\-people could make C, C++ and Rust programs run in the browser.

How stable do you think this ecosystem is going to be, in terms of updates to the WASM stack, and in terms of dependencies breaking?

I'm aware WASM is already functional, so perhaps the current state can inform us on my question to a certain degree.

https://redd.it/1pxoqpn
@r_rust
Rust & GPUI(zed) Based Markdown Editor

First post here, I have been working on a markdown editor, which is simple and efficient(I hope) and is open souce. I have made some progress and would love some feedback if anyone is willing to give some of their valuable time.


Aster is a Markdown editor built in Rust on top of GPUI, the GPU-accelerated UI framework from the Zed team.

https://github.com/kumarUjjawal/aster

https://redd.it/1pxmorp
@r_rust
Utoipa vs Aide (for axum OpenAPI generation)

Hi all,

I wanted to hear from people with experience with both what their thoughts were.

My main motivation for using Utoipa is because i was under the impression that it was the default.

I am now building the documentation for my routes and was wondering whether i would be better served using Aide as the api documentation just happens.

I’m still in early development and will be introducing breaking changes so i would like to minimise the effort i spend rewriting docs and making sure i haven’t missed anything.

I have a few testing customers who wanted early access at a discount and so i figured having the docs automatically update properly on new routes or changed routes would be nice.

Thoughts?


https://redd.it/1pxq5q4
@r_rust
This media is not supported in your browser
VIEW IN TELEGRAM
[Media] I made a terminal application for personal banking needs.
https://redd.it/1pxpj7q
@r_rust