Check out the crate indexmap
. Check its dependants too if you want to see how higher level abstractions can be built utilizing it.
- 1 Post
- 11 Comments
badmin@lemm.eeto Rust Programming@lemmy.ml•When I have an `Option<Result<T, E>>` but need a `Result<Option<T>, E>`4·4 months agoIt’s just a “joke” about the method name.
badmin@lemm.eeto Rust@programming.dev•Rust-Written Zlib-rs Is Not Only Safer But Now Outperforming Zlib C Implementations4·4 months agoWhat happens if you use an out of range array subscript a[n]? Does that always return an option type?
It never returns an option type. This
Index
interface happens to be actually noisy as implemented for some std types. Although you can implement it however you like for your own data types (including ones just wrapping the std ones). And we have checked access (example) and unchecked access (example) as methods.It’s actually astonishing the lengths you’re taking to NOT learn anything, to the point of just imagining things about Rust that are supposedly done wrong compared to Ada.
badmin@lemm.eeto Rust@programming.dev•Rust-Written Zlib-rs Is Not Only Safer But Now Outperforming Zlib C Implementations4·4 months agoWrapping and Saturating are available as data types in std. Checked can’t be a (useful) data type as-is because it by definition changes the type of the return value of operations (
Option<T>
instead ofT
). But you can trivially add a noisy/signalling wrapper yourself if you wish to (basically doing checked ops and unwrapping all results). An example of something offering a noisy interface is a crate named noisy_float.
badmin@lemm.eeto Rust@programming.dev•Rust-Written Zlib-rs Is Not Only Safer But Now Outperforming Zlib C Implementations5·4 months agoRust supports wrapping, saturating, and checked operations, which allows you to precisely define the behavior you want from your math operations, and avoiding ever hitting an (unchecked) overflow.
badmin@lemm.eeto Rust@programming.dev•Rust-Written Zlib-rs Is Not Only Safer But Now Outperforming Zlib C Implementations62·4 months agoI don’t downvote people, but since you asked.
here has been a zlib in Ada for many years, doing its job quietly.
Who asked?
Speed comparable to the C version, probably not beating it, but not trailing by much in any case.
There is no one C version. The version being referred to is the original zlib, which happens to be the worst implementation of four possible zlib back-ends available in the
flate2
crate. Besides the originalzlib
andzlib-rs
, there is zlib-ng andcloudflare_zlib
, both of which are also (still) implemented in C.So being comparable to the original zlib is hardly something to shout about. In fact, individual hobbyists have been beating that implementation just for fun for many years.
Rust is safer than C but less safe than Ada from what I can tell.
Rust (edited for clarity) looks to me to be about halfway between C and C++ in complexity, with a bunch of footguns removed, and using implicit move semantics (“borrowing”) more than C++ does, and the notorious borrow checker is simply the compiler making sure you don’t make RAII mistakes because of that.
That’s a lot of inaccurate waffling that could have been entirely written by an LLM, except it’s probably too wrong for it to have been done so.
Source? What is the percentage of trolls that were even chased and successfully denonymized?
What X11-only apps/programs did you need xwayland for?
I actually always disabled xwayland whenever I experimented with wayland (weston and sway), because everything I use is supported natively, and I wanted to make sure the native support was forced.
I’m not abandoning my Awesome WM setup anytime soon personally. But I thought it’s worth sharing this perspective from someone who knows this stuff much better than me.
Fun Fact: Rust didn’t always support leading pipes (which are optional), not even at v1.
Unless I’m hallucinating memories, the support was added with influence from Haskell.
so sad 🎤 🎻😢