r/rust • u/noop_noob • 14h ago
π questions megathread Hey Rustaceans! Got a question? Ask here (49/2026)!
Mystified about strings? Borrow checker has you in a headlock? Seek help here! There are no stupid questions, only docs that haven't been written yet. Please note that if you include code examples to e.g. show a compiler error or surprising result, linking a playground with the code will improve your chances of getting help quickly.
If you have a StackOverflow account, consider asking it there instead! StackOverflow shows up much higher in search results, so ahaving your question there also helps future Rust users (be sure to give it the "Rust" tag for maximum visibility). Note that this site is very interested in question quality. I've been asked to read a RFC I authored once. If you want your code reviewed or review other's code, there's a codereview stackexchange, too. If you need to test your code, maybe the Rust playground is for you.
Here are some other venues where help may be found:
/r/learnrust is a subreddit to share your questions and epiphanies learning Rust programming.
The official Rust user forums: https://users.rust-lang.org/.
The unofficial Rust community Discord: https://bit.ly/rust-community
Also check out last week's thread with many good questions and answers. And if you believe your question to be either very complex or worthy of larger dissemination, feel free to create a text post.
Also if you want to be mentored by experienced Rustaceans, tell us the area of expertise that you seek. Finally, if you are looking for Rust jobs, the most recent thread is here.
r/rust • u/Squeezer • 2d ago
π this week in rust This Week in Rust #680
this-week-in-rust.org
r/rust
•
u/GyulyVGC
•
23h ago
π οΈ project I just found out NVIDIA is using my Rust crate for one of their CLIs
Some days ago I saw a post in this sub talking about how vibe-coding is taking away the joy of programming, and today while browsing one of my old crates I noticed something that made me reflect on it.
I saw the download number of my crate (listeners) raising over the past weeks and hitting 1 million, so I started looking at its dependents on GitHub and crates.io and with my surprise I found out that NVIDIA is using it for its NeMo Relay CLI.
Turns out this isn't even directly responsible for the increasing download number of my crate, but still this is one of the little satisfactions of a programmer life.
Then I ask myself if today (with LLMs) people would even consider developing a whole library to solve an existing problem, or if they'd just put in place a quick solution in-house for their specific use case.
The point of the post? No real point, just that I feel like despite I'm still young this is one of the last programming satisfactions of this kind that I experience... hope to be wrong and that new opportunities to find joy in what we do will come up though.
r/rust • u/TheEmbeddedRustacean • 9h ago
The Embedded Rustacean Issue #86
theembeddedrustacean.comr/rust • u/OkBreath9382 • 1d ago
π οΈ project Emitting typed assembly so we don't have to rely solely on the compiler
There have been some recent discussions about soundness bugs in the Rust compiler, especially on X. For example, I saw a tweet criticizing rust-lang/rust#160525, where entirely safe Rust code can trigger a use-after-free, while the compiler accepts it:
fn main() {
let mut arr = [[Box::new(42)]];
let alias = &mut arr[0][{
let [row] = arr;
drop(row);
0
}];
println!("{}", **alias);
}At the assembly level, the problematic pattern looks roughly like this (simplified RV64 assembly):
mv a0, s0
call __rust_dealloc
lw a0, 0(s0) # use-after-freeTo catch this kind of soundness bugs without relying solely on the compiler, I've been experimenting with an old idea from proof-carrying code and typed assembly languages in NoCompiler (https://github.com/h5i-dev/NoCompiler), and the result seems promising.
Specifically, It introduces a Rust-like type system directly into assembly, and implementes a Rust compiler extension that emits typed assembly (currently only targeting RV64).
Here's a simplified example of the generated typed assembly:
#: fn borrowck_soundness_bug [x0] in a0: i64(x0) borrow Heap where -2147483648 <= x0 < 2147483648 out a0: int frame 32 slots 8, 16, 24 stack 4128
#: extern fn alloc [n, a] ... give q != 0 => q |-> bytes[n] rw heap ...
#: extern fn dealloc [p, n, a] ... take p |-> bytes[n] rw heap ...
.attribute 4, 16
.attribute 5, "rv64i2p1_m2p0_a2p1_..."The generated annotations aren't particularly human-readable, but the type checker successfully rejects the assembly generated for this soundness bug. I've implement a fast type checker in Rust, along with a formally verified checker written in Lean 4 (though the formal specification itself could still be wrong).
I'm hoping to extend the Rust compiler integration to other architectures as well. I'd love to hear your thoughts!
ποΈ discussion How do you monitor Rust web applications in production?
Disclosure: I maintain StatLite, an open-source monitoring tool that I use for my own applications running on small VPS.
I've been asked about Rust support, so I started exploring the monitoring options for Axum and Actix Web.
I've added lightweight instrumentation recipes for both frameworks. They collect request counts, HTTP errors, average response time, process CPU, and RSS - without requiring an additional monitoring crate.
In my experiments, these recipes had a smaller binary size, lower memory overhead, and a significantly smaller metrics payload than the Prometheus-based instrumentation I tested.
The recipes and benchmark results are here:
- Actix Web: https://github.com/PVRLabs/statlite/blob/main/docs/integrate/rust/actix-web.md
- Axum: https://github.com/PVRLabs/statlite/blob/main/docs/integrate/rust/axum.md
I'm also considering native integration with existing Prometheus exporters, so users don't need to add custom instrumentation.
I wonder what people here actually use to monitor their Rust applications. Prometheus, OpenTelemetry, something simpler? Are there particular libraries you'd recommend supporting?
I'd be happy to add native integrations if there is interest.
r/rust • u/frozen_beak • 11h ago
π§ educational Devlog: Optimizing f64 GEMM from 6.5 to ~40 GFLOP/s with a BLIS-style micro-kernel
https://adii.fyi/blog/optimizing-matmul-in-rust-from-naive-loops-to-blis/
I wanted to see how far I could push a single-threaded f64 matmul. Started with the usual i-k-j loop, and then spent quite a bit of time looking at asm, then experimenting with SIMD, and eventually working through BLIS-style blocking and packing.
Writing this up was a good way to document the whole process, so thought I'd share it here.
r/rust • u/TheMadnessofMadara • 16h ago
π seeking help & advice Leptos not generating JS and WASM files
Leptos not generating JS and WASM files when I cargo leptos watch. It does generate the css file in the target/site/pkg. It will buld the saite, but the site has no functionality. I have spent waaay too long on this and just want it running like it should. Any help? There is not git repo, only local so the error is confusing when I use verbose. Other wise no error... I can see as the terminal cuts off before it ends.
Note: I am
cargo leptos build -v
Location:
C:\Users\me\.cargo\registry\src\index.crates.io-1949cf8c6b5b557f\cargo-leptos-0.3.10\src\command\build.rs:25
ββββββββββββββββββββββββββββββββββ BACKTRACE βββββββββββββββββββββββββββββββββββ
1: git_filter_source_repo<unknown> at <unknown source file>:<unknown line>
2: git_filter_source_repo<unknown> at <unknown source file>:<unknown line>
3: git_diff_stats_to_buf<unknown> at <unknown source file>:<unknown line>
4: BaseThreadInitThunk<unknown> at <unknown source file>:<unknown line>
5: RtlUserThreadStart<unknown> at <unknown source file>:<unknown line>
.cargo/config.toml
#to stop a recursation involving thaw going 130 levels deep
[build]
rustflags = ["--cfg", "erase_components"]lib.rs
pub mod app;
pub mod db;
#[cfg(feature = "hydrate")]
#[wasm_bindgen::prelude::wasm_bindgen]
pub fn hydrate() {
Β Β use crate::app::*;
Β Β console_error_panic_hook::set_once();
Β Β leptos::mount::hydrate_body(App);
}Cargo.toml
[package]
name = "example-leptos"
version = "0.1.0"
edition = "2021"
[lib]
crate-type = ["cdylib", "rlib"]
[dependencies]
leptos = { version = "0.8.23", features = ["ssr"] }
leptos_router = { version = "0.8.17" }
axum = { version = "0.8.8", features = ["ws", "macros", "multipart", "http2"], optional = true }
axum-extra = { version = "0.12.5", features = ["protobuf", "multipart", "typed-header"], optional = true}
axum-server = Β { version = "0.9.0", features = ["tls-rustls"], optional = true }
console_error_panic_hook = { version = "0.1", optional = true }
leptos_axum = { version = "0.8.0", optional = true }
leptos_meta = { version = "0.8.7" }
tokio = { version = "1.54.1", features = ["macros", "rt-multi-thread"], optional = true }
wasm-bindgen = { version = "0.2.130", optional = true }
wasm-bindgen-futures = { version = "0.4", optional = true }
cookie = { version = "0.18.1", optional = true }
blob = "0.3.0"
bytes = "1.9.0"
bytes-utils = "0.1.4"
chrono = { version = "0.4.44", features = ["alloc","serde"]}
derivative = "2.1.0"
dotenv = "0.15.0"
env_logger = "0.11.6"
fred = { version = "10.0.4", features = ["serde-json", "enable-rustls", "rustls"], optional = true }
futures = "0.3.34"
futures-util = "0.3.34"
generic-array = "1.4.5"
hex-literal = "1.0.0"
http = "1.5.0"
image = "0.25.6"
lazy_static = "1.5.0"
lettre = "0.11.23"
lettre_email = "0.9.4"
log = "0.4.34"
rand = "0.10.3"
reqwest = { version = "0.13.5", features = ["json"] }
rust_decimal = "1.43.0"
serde = { version = "1.0.229", features = ["derive"] }
serde_json = "1.0.151"
sqlx = { version = "0.9.0", features = ["rust_decimal", "postgres", "runtime-tokio", "tls-rustls", "uuid", "chrono"], optional = true }
thiserror = "2.0.21"
tokio-task-scheduler = { version = "1.0.0", optional = true }
tower-http = { version = "0.7.1", features = ["compression-br", "compression-gzip","limit", "trace","cors","fs"], optional = true }
tower-sessions = { version = "0.15.0", optional = true }
tower-sessions-core = { version = "0.15.0", optional = true }
tower-sessions-redis-store = { version = "0.17.0", optional = true }
tower_governor = { version = "0.8.0", optional = true }
tracing = "0.1.44"
tracing-subscriber = { version = "0.3.22", features = ["env-filter"] }
webauthn-rs = { version = "0.6.2", features = ["danger-allow-state-serialisation", "danger-credential-internals"], optional = true }
thaw = { version = "0.5.0-beta", features = ["ssr"] }
leptos-remix-icon = "1.0.3"
leptos-use = "0.20.0"
icondata_core = "0.1.0"
tower = { version = "0.5.3", optional = true }
cfg-if = "1.0.5"
icondata = "0.7.0"
meilisearch-sdk = { version = "0.33.0", optional = true }
leptos_meilisearch = "0.7.0"
dotenvy = "0.15.7"
leptos-use-window = "0.20.1"
time = "0.3.55"
[dependencies.web-sys]
version = "0.3.107"
optional = true
features = ["AbortController", "AbortSignal", "AuthenticationExtensionsClientOutputs", "AuthenticatorResponse", "Clipboard", "CredentialCreationOptions", "CredentialRequestOptions", "CredentialsContainer", "DomException", "Element", "Event", "Headers", "HtmlCollection", "HtmlSelectElement", "Navigator", "PublicKeyCredential", "PublicKeyCredentialCreationOptions", "PublicKeyCredentialRpEntity", "PublicKeyCredentialUserEntity", "Request", "RequestCredentials", "RequestInit", "RequestMode", "RequestRedirect", "Response", "Window"]
[dependencies.webauthn-rs-proto]
version = "0.6.2"
default-features = false
features = ["wasm"]
[features]
hydrate = [
Β Β "leptos/hydrate",
Β Β "thaw/hydrate",
Β Β "dep:console_error_panic_hook",
Β Β "dep:wasm-bindgen",
Β Β "dep:wasm-bindgen-futures",
Β Β "dep:web-sys",
]
ssr = [
Β Β "dep:axum",
Β Β "dep:axum-extra",
Β Β "dep:axum-server",
Β Β "dep:cookie",
Β Β "dep:tokio",
Β Β "dep:tokio-task-scheduler",
Β Β "dep:leptos_axum",
Β Β "dep:fred",
Β Β "dep:sqlx",
Β Β "dep:tower",
Β Β "dep:tower-http",
Β Β "dep:tower-sessions",
Β Β "dep:tower-sessions-core",
Β Β "dep:tower-sessions-redis-store",
Β Β "dep:meilisearch-sdk",
Β Β "dep:webauthn-rs",
Β Β "dep:tower_governor",
Β Β "leptos/ssr",
Β Β "leptos-use/ssr",
Β Β "leptos_meta/ssr",
Β Β "leptos_router/ssr",
Β Β "thaw/ssr",
]
[target.'cfg(target_arch = "wasm32")'.dependencies]
getrandom = { version = "0.4.3", features = ["wasm_js"] }
[target.'cfg(target_arch = "wasm64")'.dependencies]
getrandom = { version = "0.4.3", features = ["wasm_js"] }
# Defines a size-optimized profile for the WASM bundle in release mode
[profile.wasm-release]
inherits = "release"
opt-level = 'z'
lto = true
codegen-units = 1
panic = "abort"
[package.metadata.cargo-all-features]
denylist = ["axum", "tower", "tower-http", "tokio", "sqlx", "leptos_axum"]
skip_feature_sets = [["ssr", "hydrate"]]
[package.metadata.leptos]
# The name used by wasm-bindgen/cargo-leptos for the JS/WASM bundle. Defaults to the crate name
output-name = "example-leptos"
# The site root folder is where cargo-leptos generate all output. WARNING: all content of this folder will be erased on a rebuild. Use it in your server setup.
site-root = "target/site"
# The site-root relative folder where all compiled output (JS, WASM and CSS) is written
# Defaults to pkg
site-pkg-dir = "pkg"
# [Optional] The source CSS file. If it ends with .sass or .scss then it will be compiled by dart-sass into CSS. The CSS is optimized by Lightning CSS before being written to <site-root>/<site-pkg>/example-leptos.css
style-file = "style/main.scss"
# Assets source dir. All files found here will be copied and synchronized to site-root.
# The assets-dir cannot have a sub directory with the same name/path as site-pkg-dir.
#
# Optional. Env: LEPTOS_ASSETS_DIR.
assets-dir = "public"
# The IP and port (ex: 127.0.0.1:3000) where the server serves the content. Use it in your server setup.
site-addr = "127.0.0.1:3000"
# The port to use for automatic reload monitoring
reload-port = 3001
# [Optional] Command to use when running end2end tests. It will run in the end2end dir.
# Β [Windows] for non-WSL use "npx.cmd playwright test"
# Β This binary name can be checked in Powershell with Get-Command npx
end2end-cmd = "npx playwright test"
end2end-dir = "end2end"
# Β The browserlist query used for optimizing the CSS.
browserquery = "defaults"
# The environment Leptos will run in, usually either "DEV" or "PROD"
env = "DEV"
# The features to use when compiling the bin target
#
# Optional. Can be over-ridden with the command line parameter --bin-features
bin-features = ["ssr"]
# If the --no-default-features flag should be used when compiling the bin target
#
# Optional. Defaults to false.
bin-default-features = false
# The features to use when compiling the lib target
#
# Optional. Can be over-ridden with the command line parameter --lib-features
lib-features = ["hydrate"]
# If the --no-default-features flag should be used when compiling the lib target
#
# Optional. Defaults to false.
lib-default-features = false
# The profile to use for the lib target when compiling for release
#
# Optional. Defaults to "release".
lib-profile-release = "wasm-release"r/rust • u/nicoburniske • 2d ago
π οΈ project blit: immediate (yet deferred) mode UI
I've been working on this for 5 months and was hesitant to post given the flood of rust UI frameworks.
its modularity is pretty unique compared to other rust UI libs. the core is #![no_std] with zero dependencies, and it runs on embedded devices (with a very fast software renderer), TUIs, and wgpu.
it's still early and experimental, but hope you find the writeup interesting
A UI animation demo in modded GPUI, using temporal sub-frame multisampling to push perceived smoothness beyond 60Hz limits
youtu.beI modded GPUI to build a UI animation demo with temporal sub-frame multisampling. Turns out, even at 60Hz, rendering sub-frames at a higher multiple and blending them together gives you perceived smoothness well beyond the refresh rate limit.
Apple could probably make the MacBook Neo and iPad mini feel a lot less like e-waste if they tried this.
Not posting the source code since the idea and implementation are pretty simple, and it's just a demo.
(Note: Watch in 1080p60.)
r/rust • u/codelikemiley • 14h ago
π οΈ project leptos_wasi is now beating ntex and axum in our full-stack Rust benchmarks
"WebAssembly on the server will never beat native Rust."
I've been a Senior Rust SWE for 5 years, and for the last 2 of them I've been maintaining leptos_wasi taking it from 0.1 to 0.2, then 0.5, and now ultra. For most of those two years, I half-believed that quote myself.
Stock wasmtime serve + stock leptos_wasi worked great for portability and sandboxing, sure, but when you put it next to native Axum or ntex, it got smoked.
The turning point: wasm2c broke my mental model
The moment everything changed was when I experimented with compiling the guest through wasm2c and watched throughput jump massively.
Wait a second. If the same WebAssembly instructions compiled down to C could run that fast, then WebAssembly itself wasn't the bottleneck.
The bottleneck was everything around it: crossing the WASI host boundary 15 times per request, cabi_realloc thrashing, multi-threaded native abstractions dragged into a single-threaded guest, and Leptos SSR doing redundant work on every request.
I didn't want to give up the Wasm sandbox just to go fast the whole point of WASI is real isolation, portable components, and safe multi-tenant execution. So I asked a dumb question: what if we keep the full Wasmtime sandbox, keep real WASI component compatibility, and systematically kill every microsecond of overhead between the socket and the HTML?
This is NOT a "Hello World" benchmark
This is a real Leptos 0.8 full-stack app with everything people actually ship:
- SSR (routed pages with
<MetaTags/>and CSP nonces) - Islands +
islands-router(partial hydration + client-side island navigation) wasm-split(code-split island bundles + preload links)- Lazy loading & async resources
- POST server functions (
get_count,increment_count) + no-JS<form method="post">redirect fallbacks - JSON API + static assets
- Verified end-to-end in headless Chrome (hydration, split-wasm loading, islands-router nav, clicking counter buttons, no-JS SSR).
The Numbers (same machine, oha, median of 3 rotated rounds, req/s)
1 CPU (1 worker, c=16):
| endpoint | axum | ntex | leptos_wasi | vs axum | vs ntex |
|---|---|---|---|---|---|
Static counter.js | 14,128 | 10,239 | 73,400 | 5.20Γ | 7.17Γ |
| POST /api/increment_count | 51,947 | 56,589 | 55,660 | 1.07Γ | 0.98Γ |
| POST /api/get_count | 60,518 | 57,153 | 66,135 | 1.09Γ | 1.16Γ |
| Islands-router nav | 11,873 | 9,725 | 23,129 | 1.95Γ | 2.38Γ |
GET /api/hello (JSON) | 62,137 | 64,343 | 73,493 | 1.18Γ | 1.14Γ |
| Counter page (SSR + island) | 7,836 | 7,664 | 1.70Γ | 1.74Γ | |
| About page (SSR) | 12,129 | 10,428 | 22,208 | 1.83Γ | 2.13Γ |
Upfront caveats before the comment section lights me up:
- Memory: Peak RSS is 70.3 MiB on 4 CPUs vs Axum's 13.1 MiB / ntex's 21.6 MiB (Wasmtime Cranelift JIT + per-worker linear memory isn't free).
- Static files:
counter.jsis served from the host's in-memory--assetsmap before entering Wasm (vsServeDir/ntex-fileshitting the OS), so ignore that row if you only care about dynamic Rust execution β the SSR and POST server-function rows are the real story. - Still 100% sandboxed: The guest is a standard
wasm32-wasip2component running inside Wasmtime's linear memory sandbox β and the exact same.wasmbinary still runs unmodified on stockwasmtime serve.
How we did it: every optimization (and what we threw away)
Every single optimization below was gated on reproducible 1-CPU and 4-CPU A/B benchmarks (3% regression gate on every endpoint; if an idea didn't show a clear win, we deleted it).
1. Killing the WASI host-call tax: 15 host calls β 9 β 0
Crossing guestβhost is where small WASI requests die.
- Lazy
wasi:httpadapter (15 β 9 calls on stockwasmtime serve**)**: Never fetch headers,scheme, orauthorityunless the handler actually reads them. Onefields.from-listfor response headers, skipset-status-codefor 200,blocking-write-and-flushin 4 KiB chunks, and poll ready futures inside the guest with zero pollables. - Shared-memory Mailbox ABI v1 (9 β 0 calls on GET/SSR): The guest exports a tiny
#[repr(C)]struct (lean:mailbox). Our custom Wasmtime host writes the method + target straight into guest linear memory before callinghandle, and reads status/headers/body pointers straight back out. Zerowasi:httpcalls, zerocabi_reallocre-entries. On stockwasmtime serve, the guest reads one word (state == 0) and falls back seamlessly towasi:http. - Mailbox ABI v2 β inline request headers & body (POST: 8β9 calls β 0): This was the last boss. Even after crushing Axum and ntex on SSR,
POST /api/get_countandPOST /api/increment_countsat at ~41β49k req/s becausefields.entriestriggered1 + 2*Hnestedcabi_realloc.call_asyncre-entries (11β14 nested re-entries per POST!). Mailbox v2 adds independent 4 KiB request-header and 8 KiB request-body buffers with presence flags (if either overflows, only that half falls back towasi:http, and v1 guests still work).islands-routerheader checks scan raw bytes without even allocating aHeaderMap. Result:get_count+47% (142k β 209k on 4 CPUs),increment_count+51.5% (119k β 181k).
2. Leaning into single-threaded Wasm (where native pays Arc/Mutex tax)
Native frameworks pay for Send + Sync, atomics, Arc<Mutex<...>>, Tokio work-stealing, and tower middleware layers on every request. wasm32 is single-threaded by construction with 32-bit pointers:
talcsingle-threaded allocator (replacingdlmalloc): Zero locking, much faster small-object alloc/free during SSR DOM rendering.- Wasm SIMD128 (
-C target-feature=+simd128): Vectorized byte scanning, copies, and string operations in Wasmtime's Cranelift JIT. - Zero-alloc unused features:
ResponseOptionsis a thread-local handle allocated only when mutated (notArc<Mutex<...>>per request), one reused waker per thread, route table built once per instance, process-wide redirect hook.
3. Fixing Leptos SSR hot paths (where the CPU actually went)
Once transport hit ~0 Β΅s, the profiler pointed straight at Leptos SSR itself:
- One
<head>scan instead of four: The app's<head>was ~13 KB, and stockleptos_meta+ split-wasm preload injection + CSP nonce rewriting scanned it for</head>up to 4 times per request. Patchedleptos_metato insert at<!--HEAD-->and merged adapter edits into a singlememchr::memmempass: +24% on Counter, +32% on About. - Opt-in external, content-hashed
HydrationScripts: Instead of re-emitting ~12 KB of inline islands bootstrap JS into every single HTML response (and scanning/copying it every request), serve it once at a content-hashed same-origin URL (/__leptos_hydration.<hash>.js) with immutable caching. - Patched
leptos_routerfor SSR: Fast-path/path?querysplitting without running the fullurlcrate unless normalization is needed (was 12% of routed SSR), plain data for nested route params/matched paths instead of memos + signals + boxed loader futures per level, and splitting static vs reactive<A href=...>withEitherso fixed links don't allocate closures or cloneStrings. - Cached
islands-routerbranch markers intachys(format type name once per thread instead of allocating aStringon every render).
4. What we tried and threw away
Half of performance work is deleting clever ideas that don't actually move the needle:
- Caching converted response header lists (no gain)
- Wasmtime
pooling-allocator/ custom guard sizes (within Β±5%) - Wasmtime
-C inlining=y(actually made SSR slower: 62k β 53k) - 8 worker threads on 4 CPUs (worse)
memchr::memmeminleptos_metaon top of SIMD128 (within noise)- Sailfish-style
StreamBuildercapacity hints +memchrattribute escaping intachys(within noise)
"Wait β couldn't Axum/ntex use the Leptos SSR patches too?"
Yes! And that's honestly the coolest part of this whole journey:
- Even on
POST /api/get_count,POST /api/increment_count, andGET /api/helloβ which touch none ofleptos_router,leptos_meta, orHydrationScriptsβ sandboxed Wasm + Wasmtime is 1.07β1.45Γ faster than native Axum and tied with or faster than native ntex. - Most of our SSR patches (
leptos_routerstatic<A>& plain-data SSR routes,leptos_metasingle-scan, externalHydrationScripts) can be upstreamed to make native Leptos faster too.
Two years ago I was just trying to make leptos_wasi 0.1 compile and render a page. Seeing wasm2c proved Wasm wasn't inherently slow β and now ultra proves you don't even have to give up the Wasmtime sandbox to go toe-to-toe with (and beat) native Rust web stacks.
Repo: https://github.com/codeitlikemiley/leptos_wasi (ultra branch + PR #64 for mailbox v2; full methodology, browser tests, and raw CSVs in docs/optimizations.md and benchmarks/compare/).
Tear the benchmarks apart β I'll happily run any A/B or profile whatever you think I missed.
r/rust • • 13h ago
i reimpliment unix tool wc -- a period of comfortable time
This is a post to share my feelings.
As a first-time Rust user, Iβd always heard that Rustβs checker is very strict β and it really is.
but I feel very very very comfortable during this cooperation.
rust force me to reinforce bad codes -- shared reference first, mutable reference later
What I mean is that Rustβs memory safety gives me a lot of confidence.
if results are wrong, i can comfirm my codes boast problems most likely.
what my codes do:
I encapsulated a cache structure to hold the handle and buffer
Then I implemented the Iterator trait
I implemented automatic data refresh during iteration
Iβm excited to have finished this attempt because I completely write by myself.
Rust, in particular, gave me really good feedback.
I used AI lightly for sentence polishing and translation.
NOT WHOLE.
r/rust • u/ImplementCreative106 • 1d ago
Runtime reloadable and removable plugins in rust like cordis
Hi rust community, I think I learnt rust to build webscraper that was efficient for a college project 2,3 years ago given my knowledge is almost none, let's dig into my problem and I would love to have some perspectives or opinions or anything at this point lol,
So I heard rust doesn't have a stable ABI and more and more .
I was inspired by cordis (the javascript meta framework (ik js mentioned)) I wanted to be able to do something of my own harness ik ik lot of questions on why you want to make you own blah blah but I have a potato pc comes with a fair share of problems .
Now the main question is there are implementation of cordis in rust but they truly don't do like do 0 memory waste or 0 cpuc cycle waste not truly 0 but I hope you get the point there is GC so .
I know that this is going to be a tradeoff right now my only options seems to build a binary and replace it inplace with a new one while keeping track of the old one and replacing when it's all good. But thats not really a good way given I have keep track of current binary and previous binary and my original binary just incase so how do I do this ?
TLDR: how do I achieve runtime plugin reloading the rusty way , i do not want to do wasm and all that integrations would leave the point of being rusty and not bloating it.
r/rust • u/Exact_Bass_9828 • 1d ago
The Rust book
I'm from Egypt and I want a physical copy of The Rust Programming Language book, does anyone know where to find it?
π οΈ project First project I've done (very mundane
Conway's Game of Life, everything generates randomly so everytime you reopen it you'll get a bunch of new patterns
r/rust • u/caoimhin_o_h • 1d ago
π οΈ project Bald: the worldβs fastest linker
Hi all,
Iβve been working for the past few months on a much faster linker for all major platforms. Today I finally announce Bald. It is significantly faster than all competitors and supports ELF (Linux), Mach-O (macOS) and PE/COFF (Windows).
Bald is almost entirely Rust. It is feature-complete (this was quite unpleasant) and supports incremental linking (most linkers do not).
I wrote a short blog post with some more info: https://heavey.dev/2026/12/04/bald/
r/rust • u/ManthanRampal • 1d ago
Started my journey to Rust
Hi everyone , I just started my journey to learn RUST.
I am being a dot net developer from last 8 years
I started learning RUST, with hope to land a job as a RUST developer
My motivation to learn RUST is because I feel
In future space doesn't matter because we already move from floppy disk to those Peta bytes size drives
So I feel what matters will be a something which is gonna able to process those data fatly.
And I feel currently RUST is good for that.
So yes I will post my learning in the community ,
Let's see I would land to some great people and keep in connect with them.
:-)
r/rust • u/Espain-Tellcts • 1d ago
ποΈ discussion Which tech stack should I choose in Rust?
I recently want to build a RAG knowledge-base application entirely in Rust. Are there any good frameworks for this? And what mature libraries are available for document chunking and vectorization? Thanks, everyone!
r/rust • u/EuroRust • 2d ago
Lessons from building a background task processing library - Njuguna Mureithi | EuroRust 2026
youtu.beAt EuroRust in Barcelona, Njuguna shared lessons from five years of building a background task processing library in Rust, from workers as actors to middleware and graceful shutdown π¦β¨
In 2027 EuroRust is going to Prague! Learn more and get your ticket at eurorust.eu.
r/rust • u/ninja-Nithin • 1d ago
π seeking help & advice How trait work
i saw this code in stack overflow
// Source - https://stackoverflow.com/a/45040455
// cargo-deps: fs2
extern crate fs2;
use fs2::FileExt;
use std::io::Result;
use std::env::args;
use std::fs::File;
use std::time::Duration;
use std::thread::sleep;
fn main() {
run().unwrap();
}
fn run() -> Result<()> {
let sleep_seconds = args().nth(1).and_then(|arg| arg.parse().ok()).unwrap_or(0);
let sleep_duration = Duration::from_secs(sleep_seconds);
let file = File::open("file.lock")?;
println!("{}: Preparing to lock file.", sleep_seconds);
file.lock_exclusive()?; // block until this process can lock the file
println!("{}: Obtained lock.", sleep_seconds);
sleep(sleep_duration);
println!("{}: Sleep completed", sleep_seconds);
file.unlock()?;
println!("{}: Released lock, returning", sleep_seconds);
Ok(())
}in this code what use fs2::FileExt; will do lock_exclusive() and unlock() are used from let file = File::open("file.lock")?;
- fs2 can overwrite another library like adding extra fn
- how rust compiler handle this
- can i create my own lib can provide something like this
- what is trait