3 ms·
Rust has: - serde; this beats both cpp and Python in terms of not spending a second of dev time on implementing serialisation deserialisation unless you're doi
by aldanor 3y ago
Rust has:
- serde; this beats both cpp and Python in terms of not spending a second of dev time on implementing serialisation deserialisation unless you're doing something funky. I would argue that this is one of the cases where it's much harder to handle it in Python than in rust
- other proc-macros allowing you to quickly map your structs to sql or whatever else
- lsp that works with zero configuration and beats many languages (again, cpp and Python included) because of rust's strictness, and rust-analyser is an absolute pleasure to work with
- cargo tooling and zero-pain dependency management; high quality of packages in general
Once you get past the initial learning curve and get comfortable with the language, these factors (and quite a few more not directly related to the language itself) eventually become more and more important for prototyping. (all subjective of course)
- culebron21 3y agoWhich crate does map structures into SQL?
- saintfiends 3y agosqlx [1] can definitely do this. [1] https://docs.rs/sqlx/latest/sqlx/ https://docs.rs/sqlx/latest/sqlx/
- riku_iki 3y ago> serde they have very many formats implemented. Which format is zero penalty, so I can use it and not write my own logic?
- aldanor 3y ago> they have very many formats implemented It's not "they", it's whoever wants to implement serde support for their own thing, can do it (so, many 3rd party crates have a "serde" feature that can be toggled on/off). > Which format is zero penalty This one is tough to answer unless you provide details re: what's your in-process data format, what's your target serialization format and whether it's binary or not, what's the objective function (serialization speed, deserialization speed, storage efficiency), and what exactly you mean by 'zero penalty' (which penalty?). // note that there's also alternative frameworks worth mentioning like rkyv and borsh-rs, each optimizing their own objective function
- Hasnep 3y agoPython has pydantic [1] and msgspec [2], both of which are pretty similar to serde in terms of features, and pydantic 2 has even been rewritten in Rust. [1] https://pydantic.dev https://pydantic.dev [2] https://jcristharif.com/msgspec/ https://jcristharif.com/msgspec/