#Rust
Having a single integration test binary is a great trick to decrease compilation time on large #rust projects.
https://github.com/qdrant/qdrant/pull/2033
Rework of an older shot, wanted to see how it would work in monochrome.
#urbanphotography #streetphotography #bench #water #rain #blackandwhitephotography #monochrome #abstract #towncentre #mesh #splash #raindrop #rust

Cool, #Swift has variadic generics now. I wonder if any of that work is applicable to #Rust; I haven’t really seen any public work on Rust variadic generics for like 2 years.
https://github.com/apple/swift-evolution/blob/main/proposals/0393-parameter-packs.md
Linux Audio Noise suppression using deep filtering in Rust
Link: https://github.com/Rikorose/DeepFilterNet
Discussion: https://news.ycombinator.com/item?id=36221534
Finally, here's what's actually inside that custom panic handler function seh_unwind::implementation::raise_exception: setting up an EXCEPTION_RECORD structure using the information provided by Rust's panic implementation up to here, then calling RtlRaiseExceptionwith that EXCEPTION_RECORDpassed in.
#rust #rustlang #windows #microsoft #reversing #reverseengineering
![A screenshot of the decompilation of the function `seh_unwind::implementation::raise_exception`, with the following code contents:
```
int64_t seh_unwind::implementation::raise_exception::hc52a1220c03bdc19(int32_t exception_code, char* exception_message, int64_t exception_NumberParameters) __noreturn
{
int32_t var_ac = exception_code;
int32_t status_code_ = win_defs::ntstatus::NTSTATUSError::status::h71e417d20a1a2c45(&var_ac);
struct EXCEPTION_RECORD exception_record;
__builtin_memset(&exception_record.ExceptionInformation, 0, 0x78);
exception_record.ExceptionCode = status_code_;
exception_record.ExceptionFlags = 0;
exception_record.ExceptionRecord = 0;
exception_record.ExceptionAddress = 0;
*(uint32_t*)((char*)exception_record.ExceptionAddress)[4] = 0;
exception_record.NumberParameters = exception_NumberParameters;
int64_t* exception_info_ptr;
int64_t exception_info_len;
exception_info_ptr = core::slice::index::impl$4::index_mut<usize>(exception_NumberParameters, &exception_record.ExceptionInformation);
core::slice::<impl [T]>::copy_from_slice::h17325824e865690e(exception_info_ptr, exception_info_len, exception_message, exception_NumberParameters, &str_"seh_unwind\src\lib.rs");
RtlRaiseException(&exception_record);
trap(6); // ud2 instruction (invalid opcode panic)
}
```](https://assets.toot.cafe/cache/media_attachments/files/110/500/653/050/625/034/small/2aa449aa25ccc680.png)
The rust_begin_unwind function - more specifically, the rust_begin_unwind symbol - is a bit special. It is actually a symbol that the panic implementation in Rust's core library (specifically, the panic_impl function) expects to be resolved at link time, for any binary which doesn't just unconditionally abort upon panic: https://rustc-dev-guide.rust-lang.org/panic-implementation.html#core-definition-of-panic
For binaries which are using Rust's standard library, rust_begin_unwind normally just links against an implementation in the standard library (begin_panic_handler, in library/std/src/panicking.rs)
However, the Windows kernel code here is not using Rust's standard library - it has to be this way, because Rust's standard library assumes that it's running in an environment where an operating system is present underneath it to give it nice abstractions, which is clearly not the case here as the code is implementing part of the Windows operating system...
Rust programs which do not use the standard library are built with the attribute #[no_std], which means that they link against Rust's core library only, rather than both the core library and std library. The core library only provides a very limited set of APIs, does not do heap allocations, and makes no assumptions that your code is running on top of an operating system.
In this case, because the implementation of rust_begin_unwind doesn't have an implementation that the Rust core library can link against, the programmer must either provide one, or change the panic strategy to abort on panic instead (i.e. set panic = "abort" in Cargo.toml).
Luckily, other code in the kernel provides some facilities for handling and recording exceptions, via RtlRaiseException, so the code here can provide an implementation which calls that (via the wrapper function seh_unwind::implementation::raise_exception, which AFAIK is not part of any public crate)
The Rust Embedonomicon book, which is about writing Rust for embedded systems and similar restricted environments, has a chapter called "The smallest #![no_std] program" which explains this in a bit more detail, including the requirement for a panic handler implementation: https://docs.rust-embedded.org/embedonomicon/smallest-no-std.html
#rust #rustlang #windows #microsoft #reversing #reverseengineering
The Rust code in the new win32kbase_rs.sys in the Windows Kernel can also panic. What happens when it does?
There are several places where a panic is invoked in the code - they include bounds check failures (core::panicking::panic_bounds_check), indexing into a slice outside of the length of that slice (core::slice::index::slice_start_index_len_fail_rt), and assertion failures (core::panicking::assert_failed). These all eventually take a common code path through the following series of function calls:
core::panicking::panic_fmt::hd60a775b92204b91
-> rust_begin_unwind
--> seh_unwind::implementation::raise_exception::hc52a1220c03bdc19
This calls into a custom panic handler, seh_unwind::implementation::raise_exception, which calls RtlRaiseException, imported from the main ntoskrnl binary!
#rust #rustlang #windows #microsoft #reversing #reverseengineering

#Python folks: Any tips for learning it, coming from #Rust ?
I'm kind of reliant on the strictness of Rust, especially when it comes to using the wrong types and everything. Some way to force me to follow a similar style would be appreciated.
I'm also very reliant on Cargo, it's so *clean* and integrates everything nicely. I'm not sure if there's an equivalent for Python that matches Cargo.
#hatch also seems interesting for this, I just saw a toot from @airtower that might be useful: https://queer.af/@airtower/110480293814667017
Tips for how to occasionally easily sprinkle in some actual Rust would be nice too.
I will only be developing for #Linux .
Solana is hiring Senior Full Stack Engineer - Defi
🔧 #rust #typescript #react #node #redux #api #graphql #grpc #rest #blockchain #cypress #defi #web3 #aws #css #docker #gcp #html #postgresql #sql #seniorengineer
🌎 San Francisco, NYC, Chicago or Remote within N. America
⏰ Full-time
💰 $100k - $215k (Estimate)
🏢 Solana
Job details https://jobsfordevelopers.com/jobs/senior-full-stack-engineer-defi-at-solana-apr-14-2023-060c29?utm_source=mastodon.world&ref=mastodon.world
#jobalert #jobsearch #hiring
I'm trying to get my blog working with wasm, why? idk wasm just seems very cool. I'm stuck on reqwest's Response wasm struct doesn't implement Send... I'm in pain i think.
#wasm #webassembly #rust
interesting #rust post from graydon - "The Rust I Wanted Had No Future"
beautiful long post on #ReverseEngineering #Rust by Checkpoint: https://research.checkpoint.com/2023/rust-binary-analysis-feature-by-feature/

Audius is hiring Software Engineer - Full Stack
🔧 #javascript #python #rust #solidity #typescript #electron #react #reactnative #redux #blockchain #css #docker #elasticsearch #html #postgresql #redis
🌎 Remote
⏰ Full-time
💰 $120k - $170k
🏢 Audius
Job details https://jobsfordevelopers.com/jobs/software-engineer-full-stack-at-audius-co-may-31-2022-da9984?utm_source=mastodon.world&ref=mastodon.world
#jobalert #jobsearch #hiring
Single Page Applications using Rust, and GoLang Desktop App
👉 Please retweet if you ❤ Plurrrr. Thanks! 👍
I want to welcome my first IRL friend @zoop_potato to Mastodon!
He's:
- #GenZ
- super chill
- loves #tea
- a great partner to my wife's best friend
- somehow reads more wikipedia than I do
- unusually eccentric about #rust
- likely to invent an interesting but very niche #programming language
Considering most of my followers are vegan, WARNING: He's not but said that we're right; he'll be a soy boy within 10 years tops 😉.

For the DLL Hijacking video, I created a new #Rust library called Bolus. It serves as a drop-in for process injection of arbitrary shellcode for your offensive operations. Currently supports local and HTTP-sourced shellcode, including n-iteration b64 obfuscation! http://github.com/mttaggart/bolus
did some minor cosmetic changes to the #rust update policy, but if people are generally happy with it, I'm gonna merge it in a few hours (and bump the required rustc version to 1.60)
I always wanted to learn #Rust and I always wanted to code a small, simple #game. Maybe I should combine both ideas? 🤔
#rustlang #dev #gamedev #programming #SoftwareDevelopment #cargo
Finished #rustlings.
Feel like some of the exercises didn't have enough context to complete it, but the #rust docs are great. No one's posted all the solutions to the latest set of exercises either, so I put mine up if anyone else wants to go through them. https://github.com/kentarospin98/rustlings-solutions
I feel like I much better understand the language now, but there's so many things, like Arc Mutexes, the Trait system, Macros, Iterators that will just take a ton of practice to get comfortable with, and more importantly, learn design patterns to be quick to solve problems with.
Going to try out a quick little project over this weekend to see how far I can go. I've been parsing the #python AST for a work project, and I thought that was wild, where as in Rust, you just have access to the tokens to build macros in the language itself.
cargo tarpaulin, ça promet, mais mon dieu que c'est lent (je me demande si sccache aide dans ce cas) #rust
I like to think of myself as a programming language geek. But then I read something like this[1] from @graydon , and I understand I know pretty much nothing.
Part 2 of DLL Hijacking in Rust! In which we exploit Windows Defender (!) and introduce a new tool for easy process injection in #Rust.
Fixed a bug where #distrobox wouldn't see the container name when passed to my program. It was being saved as a Vector<String>, and passed through to the terminal emulator as several args. So, I joined them all together and passed it through as one, and it Just Works. Nice.
Still trying to figure out how to manage my configuration files, loading them in from the filesystem and putting them into a struct specifically.
This is a surprising write up from a popular programming language designer.
♫ You can’t always get what you want… ♫
Another Monday, another #bevymergetrain. Despite the maintainers' best efforts to merge things as we see them we have 9 PRs in the backlog today! Follow along to see how the #opensource #rust #gamedev sausage is made.
🦀 Effective Rust: 35 Specific Ways To Improve Your Rust Code
➥ David Drysdale

🦀The #Rust I Wanted Had No Future @graydon
"The Rust We Got is many, many miles away from The Rust I Wanted. I mean, don't get me wrong: like the result. It's great. I'm thrilled to have a viable C++ alternative, especially one people are starting to consider a norm, a reasonable choice for day-to-day use. I use it and am very happy to use it in preference to C++. But!
There are so, so many diferences from what I would have done, if I'd been "in charge" the whole time" https://graydon2.dreamwidth.org/307291.html

Spent all afternoon trying to get #linux installed on my old 2015 #chromebook so I'd have something to practice #rust and #rustlings on while I travel next week.
Unfortunately, my chromebook went end-of-life before the linux mode was added. When I finally got it running via crouton on a dated version of Ubuntu (that I can't upgrade without breaking) I realized that....
... the battery was non-functional.

@Jdreben @guardiarris @maegul Yes, at least #Leptos takes the #SolidJS approach of using signals to update only the minimal amount of DOM that actually changes.
Regarding JS: you don't need to touch it explicitly in those frameworks, BUT: it is still used to manipulate the #DOM.
For this to work, a lib called wasm-bindgen is used (awesome piece of technology!), which basically bridges #Rust <-> #JS:
https://rustwasm.github.io/docs/wasm-bindgen/
leptos_dom depends on it:
https://github.com/leptos-rs/leptos/blob/4ade062cd8cdbe9128aa7a2c8169c17c9d3e874c/leptos_dom/Cargo.toml#L28
Writing a tiny parser for our Arnie bot:
Any #Rust #Cryptography people out there? :blobcatwave:
I've been using the Rust OpenSSL bindings for a while now, and they're fine. They're fine.
But the lib seems to be missing any bindings for EVP_PKEY_pairwise_check() and I'd really like to use it. Support for OpenSSL v3.x apis seems to be generally lacking.
Although, I've heard OpenSSL isn't a great library in general and maybe I should try to use something else. So maybe this is a good opportunity to migrate to a better lib?
What are the good crypto libraries out there for Rust? I'm looking for implementations of basic stuff like RSA, HMAC, AES, etc. Bonus points if the implementation is actually in a memory-safe language (like Rust!).
Ring looks nice maybe? I suppose there are probably bindings for libsodium somewhere. What are people using these days?
This post highlights #Rust's priorities well.
The inventor of the language would have wanted tail calls (TCO), but the feature was ultimately rejected due to performance, linking and ABI concerns. The language targets C/C++ developers, so the argument is that tail calls can be replaced with loops, which work well, even if not elegant.
https://mail.mozilla.org/pipermail/rust-dev/2013-April/003557.html
Turns out there's a cost to the “zero cost abstractions” design philosophy.
Live streaming in 27 minutes! Writing a Matrix bot in Rust that simulates Arnold Schwarzenegger.
This time: writing a tiny parser to process arnie commands.
Just published the 8.3.0 version of the geos crate.
It prevents the compute_voronoi function to panic by adding new variants in the geos::Error enum.
New IconFontCppHeaders support for Pictogrammers Material Design icons MDI https://pictogrammers.com/library/mdi/
https://github.com/juliettef/IconFontCppHeaders is a zlib C & C++ headers, C# & Python classes, Rust files and Go package for icon fonts:
- Font Awesome
- Fork Awesome
- Google Material Design
- Pictogrammers Material Design icons
- Kenney game icons
- Fontaudio
- Codicons
Thanks Bobby Angelov for the MDI implementation and our patrons https://www.patreon.com/enkisoftware?filters[tag]=IconFontCppHeaders
#GameDev #OSS #Icon #Font #Cpp #Rust #Golang #python #Csharp
"During my visit at PyCon recently it was impossible to miss the fact that a number of Python projects are rewriting their core in Rust for performance reasons. #Rust and #Python seem to be best friends." https://groups.google.com/g/beancount/c/vPK7aJsJ8EM/m/Y-vDJ8qDBwAJ
Wow! I'm absolutely in love with the learning environment of #rust / #rustlang and #rustlings and #rustbyexample. What an incredible combo.
I wish I had a similar environment to learn #python or #julialang in.
For those who are unfamiliar, Rustlings is an interactive learn-by-fixing program you run in your terminal. It correlates directly with Rust's official guide (The Book). They even link together and to the docs. So cool!
It's here! 🎉
Announcing match-commutative | A #Rust macro that helps matching on patterns commutatively, reducing the use of duplicated patterns. ✨
This can be useful, if you need to match on `(operant1, op, operant2)`, where `op` builds a commutative relation between `operant1` and `operant2`.
Please see the docs for the actual use case and an example:
https://docs.rs/match-commutative
Tagging @rjacobson and @tuck, because they've been interested in this. 😉
"#Rust developers usually are not just looking for "less buggy".
They are addicted to the clicky sound of legos." - by @Amirography in this thread:
https://floss.social/@Amirography@fosstodon.org/110486392843897963
Urgh, this quote is so 100% true!😄
Thank you @Amirography for expressing this!
I think the biggest problem with #rust is that it's novel enough that its not the kind of thing the average #cpp developer can jump into and figure out as they go along. You gotta read a book, and getting good means writing lots of it. And most c++ developers aren't using c++ because they love it, they're using it because it pays. So the challenge is getting them excited to spend their free time training for what could hypothetically one day be their next job.
Here's a blog post benchmarking compilers by “Hello, World!” and Ruby didn't fare well.
https://drewdevault.com/2020/01/04/Slow.html
#MastoDev #FediDev #Programming #Assembly #Zig #C #Rust #Go #Java #Python #Ruby #Permacomputing

The decision to use Ruby for Mastodon was a poor choice, to put it mildly.
The diagram below shows relative energy consumption, with values normalized to the most efficient one. So C, as the most energy efficient, has the value 1.
#MastoDev #FediDev #Programming #C #Rust #CPP #Java #Lisp #Haskell #Go #JavaScript #Python #Ruby #Permacomputing

'30 year old code killed! Microsoft rewrites Windows kernel with 180,000 lines of Rust'
The latest Windows 11 Insider Preview release is the first to include the programming language Rust.
I regularly use and love #Typescript. I used to use #Python the most – it’s what I learned in and I am more interested in backends than frontends. I also am regularly using and really enjoying #Kotlin (so much better than #Java). But truly Typescript is bae.
#Julia is a joy to work with. Very much like Python but more powerful. If it had the library support Python or #JVM has I would probably prefer to use Julia for backends.
But Typescript really changed the game and now that’s probably my favorite language not just because of the language itself but because it has web dominance. Until I can write #WASM with Python or Kotlin or Rust, and I’m building #web applications, TS is my lingua franca.
I want to try #Rust because it’s the new hotness.
I wrote down some notes about porting large #Python projects to #rust: https://www.jelmer.uk/port-py-to-rust.html
Ok. So the #rust leadership may have failed miserably lately, but the community is very, very awesome!
I just complained about not being able to get my code to compile and not being able to make sense of the error messages.
So many people came to my help, so very quickly!
So... I've been trying to port some code to #rust for two weeks now, and as far as I can tell, either the compiler doesn't actually work, or all the docs are flat out lying. I'm at my wits end here.
Looking at Redis: https://docs.rs/redis/latest/redis/
Literally quoting the docs:
let client = redis::Client::open("redis://127.0.0.1/").unwrap();
let mut con = client.get_async_connection().await?;
con.set("key1", b"foo").await?;
Ok cool. Let me put this in a function:
pub async fn set() {
let client = redis::Client::open("redis://127.0.0.1/").unwrap();
let mut con = client.get_async_connection().await;
con.set("key1", b"foo").await;
}
This gives me:
error[E0599]: the method `set` exists for enum `Result<Connection<Pin<Box<dyn AsyncStream + Send + Sync>>>, RedisError>`, but its trait bounds were not satisfied
--> src/my_file.rs:37:9
|
37 | con.set("key1", b"foo").await;
| ^^^ method cannot be called due to unsatisfied trait bounds
|
::: /$HOME/.rustup/toolchains/stable-x86_64-apple-darwin/lib/rustlib/src/rust/library/core/src/result.rs:503:1
|
503 | pub enum Result<T, E> {
| ---------------------
| |
| doesn't satisfy `_: AsyncCommands`
| doesn't satisfy `_: ConnectionLike`
|
= note: the following trait bounds were not satisfied:
`Result<redis::aio::Connection<Pin<Box<dyn AsyncStream + std::marker::Send + Sync>>>, RedisError>: redis::aio::ConnectionLike`
which is required by `Result<redis::aio::Connection<Pin<Box<dyn AsyncStream + std::marker::Send + Sync>>>, RedisError>: AsyncCommands`
note: the method `set` exists on the type `redis::aio::Connection<Pin<Box<dyn AsyncStream + std::marker::Send + Sync>>>`
--> /$HOME/.cargo/registry/src/index.crates.io-6f17d22bba15001f/redis-0.23.0/src/commands/mod.rs:66:1
|
66 | / implement_commands! {
67 | | 'a
68 | | // most common operations
69 | |
... |
1861 | | }
1862 | | }
| |_^
= note: this error originates in the macro `implement_commands` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider using `Result::expect` to unwrap the `redis::aio::Connection<Pin<Box<dyn AsyncStream + std::marker::Send + Sync>>>` value, panicking if the value is a `Result::Err`
|
37 | con.expect("REASON").set("key1", b"foo").await;
| +++++++++++++++++
Ok. Cool. It tells me to add an .expect() to unwrap the connection (which doesn't make sense because it isn't optional, but we'll ignore that for now. After adding that expect I get:
error[E0698]: type inside `async fn` body must be known in this context
--> src/my_file.rs:37:20
|
37 | con.expect("").set("key1", b"foo").await;
| ^^^ cannot infer type for type parameter `RV` declared on the method `set`
|
note: the type is part of the `async fn` body because of this `await`
--> src/cache/mod.rs:37:39
|
37 | con.expect("").set("key1", b"foo").await;
| ^^^^^^
WTF?!?!
What can't the compiler understand about a static str?
Why did it allegedly work for the crate authors but doesn't work for me?
And it gets worse, because it's not just for the Redis crate. I spent a week getting sqlx to compile after reading their docs and finding out that there was little no no relation between when was in the docs and what actually compiled.
If I leave rust then it's not because of the leadership, but because the docs simply does not include working code out of the box.
Sometimes #rust doesn't let you hold `&mut self.foo` and `&self.bar` at the same time, which can be frustrating when you know those two fields have nothing to do with each other.
I always just clone and move on, but TIL `std::mem::take` can also help if these objects are big. Just remember to put back the thing tou took :)
#dotnet #csharp I saw someone mention somewhere they were using an alternative static site generator to Jekyll that was done in .net. Anyone got any good recommendations? I like Jekyll, but have little cause to program in ruby so would like same thing but built using csharp if there is something good. #python or #rust are also viable alternatives for me.
In my 4 years of #RustLang, I've never written any macros, because I didn't felt the need to learn them and I honestly felt a little intimidated by them. 😳
But holy cow have I missed out on this feature! #Rust's (Declarative) Macros can be _really_ useful!
I might put the one I'm currently implementing up on crates.io in the next few days. 🤞 The macro is able to simplify pattern matching in certain scenarios.
Stay tuned! :ferris:
Another crucial aspect in this matter of #AI rewriting your code:
You should make your tools reusable, so that others can benefit from it as well. This is not possible with #LLMs. Sure you can share the prompt, but the output is all wishy-washy.
Use a proper tool for this kind of task, e.g. ast-grep - ⚡ A fast and polyglot tool for code searching, linting, rewriting at large scale. Written in #Rust:
If a Rust frontend application panics, as a user, you see nothing. Only dead buttons. Only the developer console reveals that something is wrong.
Fixed that: Failing in style, with a new crate: https://github.com/ctron/browser-panic-hook/

I sure hope nothing dramatic happened to the governance of my favorite programming language while i was on vacation...
This seems like a great learning resource for #Rust #RustLang if you want to understand the lower level behavior of the language's high level constructs
https://eventhelix.com/rust/
RFC Proposal 😜
Request `std::toasted::Toast`
a container for type <Butter> or <Jam> or <PB> etc..
probably might need an `std::toaster`
I need more surly toast in my life.
😠 🍞
Oooh, #Rust 1.70 is stable and adds OnceCell and OnceLock. :blobcatcheer:
https://blog.rust-lang.org/2023/06/01/Rust-1.70.0.html
Finally! A stabilized way to handle non-const static initialization without needing extra crates like lazy_static!
Super useful for caching one-time setup info needed by tests that's too expensive to recompute for every test.
Like RSA key generation. Oof, that one is slow.
👆 Rustaceans will like this!
> This is what a crab looks like, and apparently what _peak performance_ might look like [...]
> When a _trait_ appears [...]
> Their diversity makes it tricky to _pin_ down [...]
Why is #RustLang so "punnable" (is that a word?)?😅
Sorry, @laurahelmuth if you have no idea of what I'm talking about. It's a joke in the #Rust programming language community.
#Rust🦀 1.70.0 released by Rust Language Release Team - sparse by default for crates-dot-io, OnceCell & OnceLock stabilized, is_terminal on fds, named levels of debug info, enforced stability in test CLI https://blog.rust-lang.org/2023/06/01/Rust-1.70.0.html #RustLang #OpenSource #cybersecurity #software #engineering #tech

Interesting discussion about editors for Rust code: https://www.reddit.com/r/rust/comments/13xe2ao/thoughts_about_zed_editor/
#Rust #RustLang
I'll be available starting July, so if you know someone that is hiring full-remote Rust freelances/contractors and is not scared away by me working a 4-day week, let's get in touch 🙌
More info on my LinkedIn post: https://www.linkedin.com/feed/update/urn:li:activity:7069959518486417409/
I'd love some help here.
I probably have not set up my #nixos #developer environment correctly but when I try to build #rust binaries for other targets it fails.
the error is
"error: linking with `rust-lld` failed: exit status: 127"
and there are 2 notes
one is a long list of paths
and the other one is: "rust-lld: error while loading shared libraries: libz.so.1: cannot open shared object file: No such file or directory"
I have tried to use overlays and flakes, none worked
#programming
Explore JetBrains 2023 Annual Highlights, Learn #Rust for Free With JetBrains Academy, @Unity DOTS Support in @JetBrainsRider, and Secure Your #PHP Code With Taint Analysis by @Qodana. https://jb.gg/newsletter-2023-march

[Quote Repost]
Want to give the most loved programming language a try?
Learn #Rust for free right in your IDE with #JetBrainsAcademy. https://twitter.com/JetBrains_Edu/status/1628010027398070280

Kudos to those who selected #Rust! You’ve probably tried it. 😉
To find out why Rust has been the most loved programming language for 7 years in a row and how you can learn it for free, check out our blog post. 👇
https://jb.gg/academy/learn-rust-with-jetbrains-ides