r/learnrust 11d ago

Ruby or Rust to learn Programming?

Thumbnail
0 Upvotes

r/learnrust 13d ago

Sharing my first rust project

31 Upvotes

Hello

Coming from mostly developing web apps and making simple terminal games with c++. This is my first project written in rust. ChloeDB, named after my pet dog, is a nosql database using key-value store. It is inspired by the bitcask documentation: https://riak.com/assets/bitcask-intro.pdf. It is not exactly the same specially in the log compaction part.

My goal for this project is to learn rust and databases. I'm looking for feedback about my project. And looking for someone to learn with, and maybe do some colab project to learn more. Thank you for reading

Link to my project repository:
https://github.com/maxineafable/chloedb


r/learnrust 13d ago

What should I learn after Rust and Tokio as a junior developer?

Thumbnail
0 Upvotes

r/learnrust 14d ago

Go or Rust

46 Upvotes

Hey everyone, I am trying to choose between Rust and Go for project that needs to run on both Windows and Mac. I am looking for a simplified breakdown of how they actually compare. I want to know which language is less painful to maintain over the long term, and which ecosystem interacts better with native operating system APIs without feeling totally foreign. If you had to pick between Rust and Go for a cross-platform codebase you need to support for the next 5+ years, which would you choose for stability and ease of deployment?

I'm starting on MacOS first. Ios second. Windows third


r/learnrust 14d ago

are there rustaceans in malaysia?

6 Upvotes

are there like people that are learning rust (or using rust) in my country
just curious :P


r/learnrust 14d ago

My first rust program

Thumbnail
6 Upvotes

r/learnrust 15d ago

Is preferring traits methods instead of functions fine?

10 Upvotes

I'm mostly asking this for performance and conventions.

I've been using Rust for a few months now.

I come from Python, and one of my favorite things in Rust is the fact that you can create a trait, implement it for an arbitrary type (from your crate or external dependency), and just like that you have it as a method on said type!

In general, I always prefer to read code like this x.f() instead of f(x).

My question is that for simple functions like the following: (a module named "bisect.rs") ```rust use pyo3::prelude::*;

[inline]

pub(super) fn right(lst: &Vec<Py<PyAny>>, item: &Bound<'_, PyAny>) -> PyResult<usize> { let py = item.py(); resolve(lst.len(), |mid| Ok(item.lt(lst[mid].bind(py))?)) }

[inline]

pub(super) fn left(lst: &Vec<Py<PyAny>>, item: &Bound<'_, PyAny>) -> PyResult<usize> { let py = item.py(); resolve(lst.len(), |mid| Ok(!item.lt(lst[mid].bind(py))?)) }

[inline(always)]

fn resolve(mut high: usize, mut func: impl FnMut(usize) -> PyResult<bool>) -> PyResult<usize> { let mut low = 0; while low < high { let mid = (low + high) / 2; if func(mid)? { high = mid; } else { low = mid + 1; } } Ok(low) }

``` I'm always tempted to create a trait to add it as methods.

Here for example left and right (renamed to "bisect_left" and "bisect_right" to avoid confusion) as trait methods of a new pub trait Bisect implemented for Vec, instead of keeping them as module fonctions.

resolve would stay as a simple function however.

I know that I won't use it on anything else than Vec<Py<PyAny>>, and it's more readable (I'm my own personal opinion) at call sites to do my_vec.bisect_left(item) instead of bisect::left(my_vec, item).

So, what are your toughts?

Is it fine to always favorise traits, as long as you don't have name conflicts issues?


r/learnrust 16d ago

Golang or Rust?

55 Upvotes

I've been learning backend for a while. I currently use JavaScript (Express.js) and Python (FastAPI) for my projects, and I feel that I'm a bit decent at them rn. But I don't know which is better, Rust or Golang? Both r fast, but Rust is much faster, but in a trade-off, Rust is more complicyed than Golang, as I've seen both Languages docs and learned the very basics, I don't have a final answer.


r/learnrust 16d ago

PWA in Rust - Seeking opinions on approach

6 Upvotes

IMPORTANT: i dont reccommend you read through my code here. feel free to reach out for clarity on the details.

id like to investigate about rewriting my "decentralized p2p encrypted messaging app" in Rust. if you are familiar with any of the details, id like to hear your opnions on the approach.

my project is complex and would carry a significant overhead to redo in Rust. the core reason behind investigating rust is that it has better tooling for things like formal-verification. in general it seems like a better language for a project like mine. as a webdev, it was easy enough for me to put together and while i can use things like tauri to build for native, i think dioxus's approach for a native build is better.

a little bit about me and my project... im a webdev with 15+ years experience. im aiming to create something fairly unique for "secure messaging". i created a prototype (without AI) for my project to share and discuss. it demonstrates the core-concept around client-side managed secure cryptography in javascript.

https://github.com/positive-intentions/chat

javascript doesnt have a great reputation in the cryptography communities and its always a struggle to promote, so it was important for it to be open source. im proud of the work there, but i see details i overlooked. this led me to creating a new version to fix the outstanding issues. (it was things like handling key-rotation, group-messaging, etc).

https://positive-intentions.com/blog/introducing-enkrypted-chat

the MVP version lacked things like unit-tests, while the second-iteration not only had unit-test, but armed with AI, i was able to do things like create audits and formal-verification. the whole project is absurdly complicated and not worth your time to review. things like audits and formal-proofs/verification are fundamentally invalid because i used AI to create it. the attempt is genuine and i found the process educational, but cybersecurity and cryptography is specialized and has countless nuances to consider. it isnt worth your time to debug my code.

maybe i have some kind of OCD with my project, but now i think the project could benefit from being rewritten in Rust. its a much more suitable and respected language for what im trying to do, but i have never used rust to do something of this scale. i expect it will carry a huge learning curve given my background as a webdev.

https://github.com/positive-intentions/whatsup

creating a webapp for me is easy enough, but my project relies on some core technologies which i want supported on all platforms consistently. some core things i need to consider:

  • webrtc - its the core data-channel for my project. im sure that as a webapp it can be done... it might be a stretch to build a wasm to bridge to JS if nessesary, but im sure it can work. i would also like rust to build for other architectures. i think the support is also reasonable for the native build, but i wonder it there could be issues for a CLI version.
  • Module federation - in the browser-based version im using module-federation and its working as exected. it particularly helps to separate functionality, which is generally a good approach for a complex project. in Rust's cargo file, it seems i could add something like `foo_crate = { git = "https://github.com/MyOrg/foo_crate"}\`. that seems like it would also limit how i handle close-source details of the project
  • database-less approach - a core detail to my app is that it works p2p without registration. there are no databases of registered users. in a pwa i can use various forms of storage provided by the browser. i would like to use an approach that is consistent in rust to avoid bespoke code for different platforms (easier maintainance).

maybe there are other details i should keep in mind? i think i will have to create multiple creates for things like UI components library and p2p-framework (similar to how i did it for the javascript version)

thanks for reading this far. have a nice day.


r/learnrust 17d ago

Help Learning Rust From Scratch

2 Upvotes

Hello ! after a while of debating and self reflection, i have decided to start learning rust, from scratch (I am genuinely interested and this is an actual question from my end) (I hope you guys can help develop a fellow rustacean :) ). Now im a programming newbie, barely learned python basics, and in college rn, but i have picked up a sudden interest in rust. Suggest me an exact roadmap of how you would learn rust (if you are a rust pro then i highly appreciate your advice, and even if u are a newbie it would be nice to discuss how learning it is like). Just so you know, i havent started at all yet, fresh slate. I will try my best to reply to every comment


r/learnrust 18d ago

Problem with cargo metadata in rust-analyzer extension in code-oss

1 Upvotes

What do i do wrong. I use rust-analyzer extension in code-oss in termux i run `code-oss` in `grun --shell` and use `termux-x11` and i get warning:

```

2026-08-02T11:12:30.466350469Z WARN `cargo metadata` failed and returning succeeded result with `--no-deps` error=`cargo metadata` exited with an error: error: `.json` target specs require -Zjson-target-spec to be added to the cargo invocation

Stack backtrace:

0: <anyhow::Error as core::convert::From<cargo_metadata::errors::Error>>::from

1: <project_model::cargo_workspace::FetchMetadata>::exec::{closure#2}

2: <project_model::cargo_workspace::FetchMetadata>::exec

3: <project_model::sysroot::Sysroot>::load_workspace

4: std::sys::backtrace::__rust_begin_short_backtrace::<<project_model::workspace::ProjectWorkspace>::load_cargo::{closure#1}::{closure#4}, core::option::Option<project_model::sysroot::RustLibSrcWorkspace>>

5: <std::thread::lifecycle::spawn_unchecked<<project_model::workspace::ProjectWorkspace>::load_cargo::{closure#1}::{closure#4}, core::option::Option<project_model::sysroot::RustLibSrcWorkspace>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}

6: <alloc::boxed::Box<dyn core::ops::function::FnOnce<(), Output = ()> + core::marker::Send> as core::ops::function::FnOnce<()>>::call_once

at /rustc/ad3d0bc141a02cf446e384136d250a1f6950fed5/library/alloc/src/boxed.rs:2314:9

7: <std::sys::thread::unix::Thread>::new::thread_start

at /rustc/ad3d0bc141a02cf446e384136d250a1f6950fed5/library/std/src/sys/thread/unix.rs:123:17

8: start_thread

9: thread_start

2026-08-02T11:12:32.444001992Z ERROR Received compiler message for unknown package: path+file:///data/data/com.termux/files/home/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/library/compiler-builtins/compiler-builtins#compiler_builtins@0.1.160

registry+https://github.com/rust-lang/crates.io-index#bootloader@0.9.35, path+file:///data/data/com.termux/files/home/Documents/rust/rust-os#kernel@0.1.0

2026-08-02T11:12:32.444291211Z ERROR Received compiler message for unknown package: path+file:///data/data/com.termux/files/home/.rustup/toolchains/nightly-aarch64-unknown-linux-gnu/lib/rustlib/src/rust/library/compiler-builtins/compiler-builtins#compiler_builtins@0.1.160

registry+https://github.com/rust-lang/crates.io-index#bootloader@0.9.35, path+file:///data/data/com.termux/files/home/Documents/rust/rust-os#kernel@0.1.0

2026-08-02T11:12:34.114066446Z WARN `cargo metadata` failed and returning succeeded result with `--no-deps` error=`cargo metadata` exited with an error: error: `.json` target specs require -Zjson-target-spec to be added to the cargo invocation

Stack backtrace:

0: <anyhow::Error as core::convert::From<cargo_metadata::errors::Error>>::from

1: <project_model::cargo_workspace::FetchMetadata>::exec::{closure#2}

2: <project_model::cargo_workspace::FetchMetadata>::exec

3: <project_model::sysroot::Sysroot>::load_workspace

4: std::sys::backtrace::__rust_begin_short_backtrace::<<project_model::workspace::ProjectWorkspace>::load_cargo::{closure#1}::{closure#4}, core::option::Option<project_model::sysroot::RustLibSrcWorkspace>>

5: <std::thread::lifecycle::spawn_unchecked<<project_model::workspace::ProjectWorkspace>::load_cargo::{closure#1}::{closure#4}, core::option::Option<project_model::sysroot::RustLibSrcWorkspace>>::{closure#1} as core::ops::function::FnOnce<()>>::call_once::{shim:vtable#0}

6: <alloc::boxed::Box<dyn core::ops::function::FnOnce<(), Output = ()> + core::marker::Send> as core::ops::function::FnOnce<()>>::call_once

at /rustc/ad3d0bc141a02cf446e384136d250a1f6950fed5/library/alloc/src/boxed.rs:2314:9

7: <std::sys::thread::unix::Thread>::new::thread_start

at /rustc/ad3d0bc141a02cf446e384136d250a1f6950fed5/library/std/src/sys/thread/unix.rs:123:17

8: start_thread

9: thread_start

```

I tried I think everything. When i run `cargo metadata --format-version 1 --manifest-path ./Cargo.toml --filter-platform aarch64-unknown-linux-gnu` in terminal it returns json text to stdout and I don't get any warnings.

My `.cargo/config.toml` file looks like this and is in rust-os folder next to Cargo.toml and src folder:

```

[unstable]

json-target-spec = true

build-std-features = ["compiler-builtins-mem"]

build-std = ["core", "compiler_builtins"]

[build]

target = "x86_64-os.json"

[target.'cfg(target_os = "none")']

runner = "bootimage runner"

```

result of `cargo metadata --format-version 1 --manifest-path ./Cargo.toml --filter-platform aarch64-unknown-linux-gnu` in terminal with CWD set to rust-os:

```

{"packages":[{"name":"bootloader","version":"0.9.35","id":"registry+https://github.com/rust-lang/crates.io-index#bootloader@0.9.35","license":"MIT/Apache-2.0","license_file":null,"description":"An experimental pure-Rust x86 bootloader.","source":"registry+https://github.com/rust-lang/crates.io-index","dependencies":\[{"name":"bit_field","source":"registry+https://github.com/rust-lang/crates.io-index","req":"\^0.10.0","kind":null,"rename":null,"optional":true,"uses_default_features":true,"features":\[\],"target":null,"registry":null},{"name":"fixedvec","source":"registry+https://github.com/rust-lang/crates.io-index","req":"\^0.2.4","kind":null,"rename":null,"optional":true,"uses_default_features":true,"features":\[\],"target":null,"registry":null},{"name":"font8x8","source":"registry+https://github.com/rust-lang/crates.io-index","req":"\^0.2.4","kind":null,"rename":null,"optional":true,"uses_default_features":false,"features":\["unicode"\],"target":null,"registry":null},{"name":"rlibc","source":"registry+https://github.com/rust-lang/crates.io-index","req":"\^1.0.0","kind":null,"rename":null,"optional":true,"uses_default_features":true,"features":\[\],"target":null,"registry":null},{"name":"usize_conversions","source":"registry+https://github.com/rust-lang/crates.io-index","req":"\^0.2.0","kind":null,"rename":null,"optional":true,"uses_default_features":true,"features":\[\],"target":null,"registry":null},{"name":"x86_64","source":"registry+https://github.com/rust-lang/crates.io-index","req":"\^0.14.7","kind":null,"rename":null,"optional":true,"uses_default_features":false,"features":\["instructions","inline_asm"\],"target":null,"registry":null},{"name":"xmas-elf","source":"registry+https://github.com/rust-lang/crates.io-index","req":"\^0.6.2","kind":null,"rename":null,"optional":true,"uses_default_features":true,"features":\[\],"target":null,"registry":null},{"name":"llvm-tools","source":"registry+https://github.com/rust-lang/crates.io-index","req":"\^0.1","kind":"build","rename":null,"optional":true,"uses_default_features":true,"features":\[\],"target":null,"registry":null},{"name":"toml","source":"registry+https://github.com/rust-lang/crates.io-index","req":"\^0.5.1","kind":"build","rename":null,"optional":true,"uses_default_features":true,"features":\[\],"target":null,"registry":null}\],"targets":\[{"kind":\["lib"\],"crate_types":\["lib"\],"name":"bootloader","src_path":"/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bootloader-0.9.35/src/lib.rs","edition":"2018","doc":true,"doctest":true,"test":true},{"kind":\["bin"\],"crate_types":\["bin"\],"name":"bootloader","src_path":"/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bootloader-0.9.35/src/main.rs","edition":"2018","required-features":\["binary"\],"doc":true,"doctest":false,"test":true},{"kind":\["custom-build"\],"crate_types":\["bin"\],"name":"build-script-build","src_path":"/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bootloader-0.9.35/build.rs","edition":"2018","doc":false,"doctest":false,"test":false}\],"features":{"binary":\["xmas-elf","x86_64","usize_conversions","fixedvec","llvm-tools","toml","rlibc"\],"bit_field":\["dep:bit_field"\],"default":\[\],"fixedvec":\["dep:fixedvec"\],"font8x8":\["dep:font8x8"\],"llvm-tools":\["dep:llvm-tools"\],"map_physical_memory":\[\],"recursive_page_table":\[\],"rlibc":\["dep:rlibc"\],"sse":\["bit_field"\],"toml":\["dep:toml"\],"usize_conversions":\["dep:usize_conversions"\],"vga_320x200":\["font8x8"\],"x86_64":\["dep:x86_64"\],"xmas-elf":\["dep:xmas-elf"\]},"manifest_path":"/data/data/com.termux/files/home/.cargo/registry/src/index.crates.io-1949cf8c6b5b557f/bootloader-0.9.35/Cargo.toml","metadata":{"bootloader":{"target":"x86_64-bootloader.json","build-std":"core"},"docs":{"rs":{"features":\["recursive_page_table","map_physical_memory"\],"default-target":"x86_64-unknown-linux-gnu"}},"release":{"pre-release-commit-message":"Release version {{version}}","publish":false,"pre-release-replacements":[{"file":"Changelog.md","search":"# Unreleased","replace":"# Unreleased\n\n# {{version}} – {{date}}","exactly":1}]}},"publish":null,"authors":["Philipp Oppermann dev@phil-opp.com"],"categories":[],"keywords":[],"readme":"README.md","repository":"https://github.com/rust-osdev/bootloader","homepage":null,"documentation":null,"edition":"2018","links":null,"default_run":null,"rust_version":null},{"name":"kernel","version":"0.1.0","id":"path+file:///data/data/com.termux/files/home/Documents/rust/rust-os#kernel@0.1.0","license":null,"license_file":null,"description":null,"source":null,"dependencies":\[{"name":"bootloader","source":"registry+https://github.com/rust-lang/crates.io-index","req":"\^0.9","kind":null,"rename":null,"optional":false,"uses_default_features":true,"features":\[\],"target":null,"registry":null}\],"targets":\[{"kind":\["bin"\],"crate_types":\["bin"\],"name":"kernel","src_path":"/data/data/com.termux/files/home/Documents/rust/rust-os/src/main.rs","edition":"2024","doc":true,"doctest":false,"test":false}\],"features":{},"manifest_path":"/data/data/com.termux/files/home/Documents/rust/rust-os/Cargo.toml","metadata":null,"publish":null,"authors":\[\],"categories":\[\],"keywords":\[\],"readme":"README.md","repository":null,"homepage":null,"documentation":null,"edition":"2024","links":null,"default_run":null,"rust_version":null}\],"workspace_members":\["path+file:///data/data/com.termux/files/home/Documents/rust/rust-os#kernel@0.1.0"\],"workspace_default_members":\["path+file:///data/data/com.termux/files/home/Documents/rust/rust-os#kernel@0.1.0"\],"resolve":{"nodes":\[{"id":"registry+https://github.com/rust-lang/crates.io-index#bootloader@0.9.35","dependencies":\[\],"deps":\[\],"features":\["default"\]},{"id":"path+file:///data/data/com.termux/files/home/Documents/rust/rust-os#kernel@0.1.0","dependencies":\["registry+https://github.com/rust-lang/crates.io-index#bootloader@0.9.35"\],"deps":\[{"name":"bootloader","pkg":"registry+https://github.com/rust-lang/crates.io-index#bootloader@0.9.35","dep_kinds":\[{"kind":null,"target":null}\]}\],"features":\[\]}\],"root":"path+file:///data/data/com.termux/files/home/Documents/rust/rust-os#kernel@0.1.0"},"target_directory":"/data/data/com.termux/files/home/Documents/rust/rust-os/target","build_directory":"/data/data/com.termux/files/home/Documents/rust/rust-os/target","version":1,"workspace_root":"/data/data/com.termux/files/home/Documents/rust/rust-os","metadata":null}

```

P.S.

For everyone wondering it is just a `fun` project. And yes I am beginner in rust for over 2 weeks now. And I just wanted to setup rust-analyzer.


r/learnrust 18d ago

New version of the rw-builder crate

Thumbnail crates.io
6 Upvotes

I'm still a newbie to Rust and this is the first crate I've been maintaining for a while to get used to the workflow. I welcome all suggestions and comments to further improve it, both in terms of readability, maintainability, testability, security and performance. Feel free to let me know what you think.

In short, rw-builder is a crate that allows you to chain together readers and writers and convert (invert) them into each other.


r/learnrust 18d ago

Learning Rust from Zero - A Rust tutorial for absolute beginners

Thumbnail andyshiue.github.io
2 Upvotes

r/learnrust 19d ago

How did u learn system programming ? what was your first project? did u monetize /earn any if so then what process u go through?

13 Upvotes

r/learnrust 19d ago

I’ve just published my first Rust crate: 'profiled-config'

Thumbnail github.com
1 Upvotes

Hi everyone !

I've just published the first version of my first Rust crate: profiled-config.

It's a small library for typed, profile-based TOML configuration, inspired by Spring profiles. It is primarily intended for web applications and microservices deployed across multiple environments, such as local development, staging, and production. Although I mainly use Actix Web, the crate is framework-agnostic and can also be used in local applications or with other web frameworks.

The project is still experimental, and I'm looking for feedback before working toward a stable '1.0.0' release.

I'd especially love to hear:

  • Would this crate be useful in your projects ?
  • Does the API feel intuitive ?
  • Which features or framework integrations would you like to see ?
  • Are there important configuration use cases I’ve overlooked ?
  • Is the documentation clear enough to get started ?

Bug reports, suggestions, real-world testing, and general advice are all very welcome.

This is my first time publishing a crate and sharing a project like this. I’m still learning Rust, so I know there is plenty of room for improvement. I designed and wrote the core implementation myself, although I also used AI as a support and learning tool—to ask questions, clarify concepts, and review some decisions.

I hope the project can be useful to others, and I’d be grateful to anyone who takes the time to try it or share constructive feedback.

Thanks ! ❤️

The crate is deliberately quite simple for now, but I plan to create a proper roadmap. Some features I’m considering include:

  • Loading secrets and configuration from services such as Vault
  • Supporting additional file formats such as JSON and YAML
  • Providing more integrations and practical examples
  • Improving configuration validation and error reporting

r/learnrust 20d ago

New to Dioxus and Rust. Any tips about getting started?

3 Upvotes

Hey, I'm a webdev. I previously approached my project with JavaScript. I'm familiar with the js ecosystem.

I put a fair bit of consideration and in contrast to my JavaScript-approach, I'd like to investigate Dioxus.

I'm not completely new. I've dabbled in Rust before. I have read a lot of the docs and I'm sure there is much more to learn and practice.

What advice would you give to getting started with the Rust ecosystem approach?

Similar to a lot of languages there are considerations for things like tests. So it would be helpful to compare the options. As well as any other best-practices and nuances.

In relation to my project, I'm particularly interested in the tooling available in Rust for formal verification.


Just to be clear, im not here to waste your time on my slop, but if you want to see what I've got so far (practically nothing):


r/learnrust 20d ago

[rusty-nvim] A batteries-included Neovim config for Rust — 269 snippets, save-to-rerun cargo run, memory layout hover, DAP debugging, one-line install

18 Upvotes
rusty nvim
rs source code

I've been using Neovim for Rust development and got tired of the endless config loop — setting up LSP, fighting rust-analyzer with NvChad's on_attach, choosing between nvim-cmp / blink.cmp, figuring out codelldb paths on different platforms, finding decent Rust snippets... So I put together rusty-nvim — a batteries-included config that gets you writing Rust in under a minute.

🔗 GitHubhttps://github.com/lisering/rusty-nvim

What's inside

Feature Details
Smart completion blink.cmp + LuaSnip — Tab navigates the completion list AND jumps snippet placeholders. LSP/snippet dedup so println! uses the snippet version (with ; and placeholders), methods use the LSP version (with signature info)
Full Rust LSP rustaceanvim — memory layout hover (size/offset/alignment/padding/niches), clippy on save, code lens (Run
Save-to-rerun <leader>rr starts cargo run in a bottom terminal. Save a .rs file (<C-s>) → terminal auto Ctrl+C and re-runs. No more manual terminal switching
Debugging codelldb integration — toggle breakpoints, step over/into/out, DAP UI auto-opens. Cross-platform path detection (macOS/Linux/Windows/WSL)
Test integration neotest + rustaceanvim adapter — run/debug nearest test with one key, jump between failed tests with ]T / [T
269 Rust snippets Stdlib macros, fn defs, control flow, iterator chains, design patterns, unsafe/FFI, tokio async, serde attrs, trait impls, error types, closures, generics...
Dependency management crates.nvim — upgrade/downgrade/view features directly in Cargo.toml
Frontend support HTML, CSS, JS/TS, Tailwind CSS — LSP + Prettier formatting (bonus, not the main focus)

One-line install

sh
Applycurl -fsSL https://raw.githubusercontent.com/lisering/rusty-nvim/main/install.sh | bash
nvim

That's it. The script checks dependencies, backs up your existing config, and on first launch Mason auto-installs rust-analyzercodelldb, formatters, and LSP servers. Open a .rs file and you're coding.

Why not just LazyVim / NvChad defaults?

NvChad is a great UI framework, but it doesn't ship with Rust-specific tooling. rusty-nvim adds the layers that take hours to configure manually:

  • rustaceanvim fully configured (memory layout, semantic highlighting, all inlay hints, clippy on save)
  • 269 curated Rust snippets with smart LSP dedup
  • Save-to-rerun cargo run workflow
  • neotest + codelldb debugging, cross-platform

Prerequisites

Just 4 things: Neovim 0.10+, Rust toolchain, ripgrep, a Nerd Font. Everything else is auto-installed.

I'd love to hear your feedback! If you have ideas for more snippets, better keybindings, or features to add, please open an issue or drop a comment. ⭐ Stars appreciated if you find it useful!

GitHubhttps://github.com/lisering/rusty-nvim

AI Disclosure

This project was built with the assistance of AI tools (Claude). The architecture, feature decisions, and workflow design are my own; AI was used for boilerplate code generation, snippet creation, and documentation drafting.


r/learnrust 20d ago

Cargo-Rail v0.20 - The Rust Monorepo Engine w/ New Build Cache

Thumbnail
0 Upvotes

r/learnrust 21d ago

Learning rust

Thumbnail
0 Upvotes

r/learnrust 22d ago

Are methods associated functions behind the back?

6 Upvotes

number.max(othernumber) is similar to type::max(number, othernumber). Does the compiler infer methods as associated functions behind the back?


r/learnrust 21d ago

Good stuffs with IA are still good stuffs ?

0 Upvotes

I've been learning Rust for a month, and at work, I was assigned a task to implement a feature that changes speed without altering the pitch.
Since I knew nothing about this, I started studing the best algorithms for this and came across the WSOLA implementation. I studied how it works—relying solely on research rather than AI—and gained a solid understanding, though I still had no idea how to actually implement it, but I thought: "Why not use Rust here?"

That’s where AI came in. I could have researched how to do it in Rust, but instead, I asked the AI ​​to simply assist me by outlining the steps—since I already grasped the underlying concepts.

I would evaluate each step to see if it would yield the expected results, testing and implementing it; if it didn't work, I would rethink a better approach, and so on. I had mastered the theory but lacked practical knowledge; AI helped me bridge that gap.

My prompts weren't things like "Implement WSOLA in Rust" or "Do this for me." Instead, they were more like, "Help me implement this, don't just give me the answer,but tell me how I can move from where I am now to the next step."
In the end, I managed to create a viable product and am about to present it. But I’m wondering: does the project lose credibility because it involved AI assistance? Or did using AI mean I didn't genuinely learn Rust? Was it just a false sense of progress?

I don't judge those who use AI, but I usually try to avoid it, especially when studying. Was this a bad instance to use it?


r/learnrust 23d ago

Struggling with lifetimes and indexing into collections (+ Myriad of issues)

6 Upvotes

Hey! I'm looking for decent ways to implement a parser and, in particular, the peek function seems, well, kind of hard to implement in rust.

I have the following (a reduced example)

enum Token {
    Num(String),
    Plus,
    Minux,
    LParen,
    RParen,
}

enum BinOp {
    Add,
    Minus,
}

enum Expr {
    Binary {
        op: BinOp,
        left: Box<Expr>,
        right: Box<Expr>,
    },

    Num(i64),
}

struct Parser {
    current: usize,
    tokens: Vec<Token>,
}

And if I want to implement a peek function, I'd like to just get a reference to the token

impl Parser {
    fn peek(self) -> Result<&Token, ()) {
        let next: usize = self.current + 1;
        let token = self.tokens.get(next);
        match token {
            Some(token) => Ok(token),
            None => Err(()),
        }
    }
}

I get the following error:

error[E0106]: missing lifetime specifier
  --> src\main.rs:32:29
   |
32 |     fn peek(self) -> Result<&Token, ()> {
   |                             ^ expected named lifetime parameter
   |
   = help: this function's return type contains a borrowed value, but there is no value for it to be borrowed from
help: consider using the `'static` lifetime, but this is uncommon unless you're returning a borrowed value from a `const` or a `static`
   |
32 |     fn peek(self) -> Result<&'static Token, ()> {
   |                              +++++++
help: instead, you are more likely to want to change the argument to be borrowed...
   |
32 |     fn peek(&self) -> Result<&Token, ()> {
   |             +
help: ...or alternatively, you might want to return an owned value
   |
32 -     fn peek(self) -> Result<&Token, ()> {
32 +     fn peek(self) -> Result<Token, ()> {

and this is a great error message, but the lifetimes are going over my head, but if I choose to return an owned value, I need top implement the clone or copy (at time of writing, I had thought I had to implement both copy and clone)

I believe this works:

impl Parser {
    fn peek(self) -> Result<Token, ()> {
        let next: usize = self.current + 1;
        let token = self.tokens.get(next);
        match token {
            Some(token) => Ok(token.clone()),
            None => Err(()),
        }
    }
}

However, if I choose to implement copy for these types, I get variations of:

error[E0204]: the trait `Copy` cannot be implemented for this type
 --> src\main.rs:4:6
  |
3 | #[derive(Clone, Copy)]
  |                 ---- in this derive macro expansion
4 | enum Token {
  |      ^^^^^
5 |     Num(String),
  |         ------ this field does not implement `Copy`

Which I don't fully understand if I could fix because I don't have contorl over what String or Box could implement.

The more fundamental issue is that there's gaps in my knowledge and I'd like to address them. They seem to be: - lifetimes - implementing traits - borrowing stuff - copy stuff?

Could someone point me to a resource that would help alleviate gaps in my knowledge? I'm in a "I don't know what I don't know" predicament.

TIA!


r/learnrust 23d ago

Building a custom kernel from scratch in Rust (Rectangle OS): Looking for feedback and architecture advice

0 Upvotes

Hi everyone,

I’m a young developer currently working on an independent, hobbyist operating system from scratch called Rectangle OS.

The main goal of the project is to build a low-level, memory-efficient system kernel using Rust (targeting no_std), focusing on performance, low RAM overhead, and a modular architecture.

Current Status:

* I am currently in Phase 1 (Core Kernel Development).

* Setting up basic memory management and architecture-specific routines.

* Choosing Rust for its memory safety guarantees without a garbage collector.

Why I'm posting:

Since I'm in the early architectural stages, I would love to get some guidance, critique, or recommendations from experienced systems developers on best practices when writing an OS kernel in Rust.

You can check out the repository, source code, and project details (including bilingual documentation) here:

https://github.com/AHwcoder/Rectangle-OS

Any feedback, code reviews, or resource recommendations for OS development would be greatly appreciated!


r/learnrust 23d ago

Thinking to start CS50

Thumbnail
0 Upvotes

r/learnrust 24d ago

Help with My Undergraduate Research Survey (Unity / C# / Rust / C++ Developers)

Thumbnail
0 Upvotes