News for hackers. Stuff that matters.
Re:You can't Rust that by grayrest on Saturday March 31, 2018 @07:21PM (#16725699)
It's a contrived example and doesn't make a whole lot of sense aside from demonstrating what he means by handle. I'm not an expert but I'll have a go at explaining it.

Start at the `Data` struct. It contains a Copy on Write (`CoW`) reference to a vector of bytes (`u8`) with a lifetime labeled `'a`. This is the Handle for the data. You get one by calling `Data::new` and passing in something that can be converted to the CoW.

The example is hard coded to work with a vector of u32s (driven by the `Slice<u32>` in `Header`). To use it, you'd call `get_target` with an index and get a u32 back. The other methods on data are doing the pointer math (offset) and casting (`transmute`, `from_raw_parts`) the byte array into a slice of u32s in a safe way.

I don't see anything verifying that the byte array passed in is, in fact, a bunch of u32s so I assume that's a given.

Re:You can't Rust that by the_mitsuhiko on Sunday April 01, 2018 @02:21AM (#16727031)
It’s actually a simplifiedversion of what we do. We deal with debug information files and write custom cache files thag look similar to that.

https://github.com/getsentry/symbolic/tree/master/symcache/s...