@emersion Playing with rust and pointer arithmetic, what a brave man.
Be careful about offset_of. It will UB, should $field contain any kind of smart pointer, because field access automatically dereferences variables to the struct type.
rip C arrows
This looks great otherwise!!! I'm sure "Beyond Memory Safety with Types (2016)" from @InsanityBit@twitter.com will come in handy!
@emersion Any type that implements Deref (eg Rc, Box, Pin, and references).
ptr2struct.field is desugared to (*ptr2struct).field and there is no ptr2struct->field notation.
The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!
@hubert What is a "smart pointer"? You mean a complicated expression?
I've read "Beyond Memory Safety with Types (2016)", it's interesting but I'll focus on just getting the basics working for now!