3 ms·
This is a great experience report. Thank You (spoken as someone on the verge of taking the plunge into Rust, but getting stuck on lack of documentation on unsaf
by plinkplonk 10y ago
This is a great experience report. Thank You (spoken as someone on the verge of taking the plunge into Rust, but getting stuck on lack of documentation on unsafe etc)
- ekidd 10y agoI don't think we have a single line of 'unsafe' code in any of our 6 Rust projects at work. If you're using Rust for business apps, you'll basically never touch 'unsafe'. For an extreme example from a weekend project, I wrote an MPEG 2 Program Stream / Packetized Elementary Stream / subtitle image decompressor, which obviously does a lot of bit-banging. (It's an ugly old format.) And I never touched 'unsafe' once. This is typical. The only big exceptions are (1) working with existing C libraries, which isn't too hard once you get the hang of it, but which obviously requires 'unsafe', and (2) writing your own graph-like data structures from scratch, which you should avoid in favor of using an existing library like petgraph (https://docs.rs/petgraph/0.4.3/petgraph/ https://docs.rs/petgraph/0.4.3/petgraph/). Basically, a doubly-linked list or cyclic graph is the worst possibly introduction to Rust for newbie Rust programmer. Start with something easier! I mean, unless you're the kind of person who tries to pole-vault learning curves, in which case, have fun.
- moosingin3space 10y agoIf you _really_ want to learn how to use Rust to write graph-like data structures, look at this: http://cglab.ca/~abeinges/blah/too-many-lists/book/ http://cglab.ca/~abeinges/blah/too-many-lists/book/
- el_isma 10y ago> I wrote an MPEG 2 Program Stream / Packetized Elementary Stream / subtitle image decompressor, which obviously does a lot of bit-banging Are you open sourcing this? I'd love to take a look