Earlier quoted context omitted.
> The unique safety features of Rus are all about memory safety, which is not something you have to worry about at all in Python Rust gets safety with its ownership system. The ownership system brings strong guarantees around who is mutating / reading any given object. Python has uncontrolled ownership. Any function can generally mutate / store any variable you pass in. This can definitely cause bugs if a rouge funct…
wrong, rust is about exclusive ptr access, nothing more. you cannot do ReadOnly in rust.
Rust – A hard decision pays off
381–386 of 386 posts
Re: Rust – A hard decision pays off
#382Earlier quoted context omitted.
I am curious which web framework do you use? Also do you use an ORM like diesel?
We use a mix of axum, and tonic/tower, depending on if the service is internal (grpc) or external (http). And no, we do not use an ORM like diesel, since we primarily use ScyllaDB. We wrote our own - it's very nice. We have a fully type-safe scylla/cassandra client, that does static validation of the queries (which we define as annotated structs), and also, when the service starts up, it validates that the schema tha…
https://www.scylladb.com/2022/02/15/introducing-catalytic-an...
Re: Rust – A hard decision pays off
#383Earlier quoted context omitted.
I had the same experience with go, 100x performance improvements on data crunching scripts with roughly the same code. Worst part of writing it in python was simple misspellings in the last stages of the computation breaking things.
> Worst part of writing it in python was simple misspellings in the last stages of the computation breaking things. I'm not sure I understand. Was the typo in something like a dict key? Or did you add two of the wrong variables together? How did another language protect you from this? I fail to see how you couldn't also add two of the wrong variables (with the correct type) together in a different language.
Re: Rust – A hard decision pays off
#384Earlier quoted context omitted.
Forgive me for asking instead of looking, I'm still getting into rust; why do you map instead of getting the result? path.extension().map(|ext| ext == "bundle").unwrap_or(false) vs (path.extension() == "bundle").unwrap_or(false) or further up .map(|e| e.map(|e| e.path())) vs .map(|e| e.path()) Is the .map keeping any value wrapped in an iterator so you can map again? I thought it was interesting what you wrote looks…
`extension()` gives you an `Option`, remember `Path` might not be a file or file could be without extension. Why not `((path.extension() == Some("bundle"))`? I don't know, it didn't work, and I didn't want to spend too much time on it. `read_dir` gives us an iterator over `Result `, so `e` in that map is a `Result` and not a `DirEntry`. It's two different "map" functions - on Option and Result it maps "T", but on Ite…
Re: Rust – A hard decision pays off
#385Earlier quoted context omitted.
Forgive me for asking instead of looking, I'm still getting into rust; why do you map instead of getting the result? path.extension().map(|ext| ext == "bundle").unwrap_or(false) vs (path.extension() == "bundle").unwrap_or(false) or further up .map(|e| e.map(|e| e.path())) vs .map(|e| e.path()) Is the .map keeping any value wrapped in an iterator so you can map again? I thought it was interesting what you wrote looks…
Not your parent, but I do know the answer. extension() returns an Option , because not every file has an extension https://doc.rust-lang.org/stable/std/path/struct.Path.html#m... map on option says "run this closure on the value if it's Some, or do nothing if it's None https://doc.rust-lang.org/stable/std/option/enum.Option.html... So after the map, we now have an Option . The unwrap_or method will say "give me the v…
Re: Rust – A hard decision pays off
#386Earlier quoted context omitted.
wrong, rust is about exclusive ptr access, nothing more. you cannot do ReadOnly in rust.
Why not? Isn't that &T like a read only wrapper of T?
it LOOKS like it's possible but it can be broken easily. again, because rust is not really about (i)mutability, it's about mem-safety - and all of those can be safely mutated with &T