3 ms·
Worth noting that, as of a week ago in nightly, there are new convenience methods on unsafe pointers to make using them a bit more ergonomic (though unsafe oper
by kibwen 9y ago
Worth noting that, as of a week ago in nightly, there are new convenience methods on unsafe pointers to make using them a bit more ergonomic (though unsafe operations will still require the `unsafe` keyword, of course). Here's the document describing the new changes: https://github.com/Gankro/rfcs/blob/0048bf68c56dd25cd2afed7717a3834a22471696/text/0000-unsafe-pointer-reform.md https://github.com/Gankro/rfcs/blob/0048bf68c56dd25cd2afed77...
As an example:
// This:
ptr::read(self.ptr.offset(idx as isize))
// Becomes this:
self.ptr.add(idx).read()
This will be in stable Rust on May 10.