This addresses the following feeback:
Your code looks really good, and very Rustic. I only have a few comments:
· In ProcessRecord you use isize for the pid and ppid. These aren’t really sizes, so I’d go with i32
· Line 102: since all you’re doing is panic!() on Err, you can just use .unwrap()
· Line 107: you could use “filter_map” instead of filter and then “collect” the results. This eliminates the need for “mut records” on line 98
· Line 126: use “filter_map”
· I’d add Cargo support
· You could consider using a map type containing vector types for storing the ppid->pid translation. That would improve performance since the record list wouldn’t getting iterated over multiple times. Unfortunately Rust doesn’t have a multimap yet (see https://github.com/rust-lang/rfcs/issues/784), otherwise you could just use that!
Using a map type for the lookup is not supported with this but will
be evaluated.
I think I'm starting to 'get it' a bit more. Rust really forces the
issue with dealing with error types and you kind of need to get deep
into all parts of the language right away to get stuff working; that
being said, the language is reasonable in size and has a relatively
small number of concepts.
Right now, this project is primarily a way to learn rust. If things
start coming together, there does seem to be some interest in a
library filling the same niche for Rust as psutil does for Python.
For now, however, the goal is to write a simple pstree visualization.