I've been playing around with Rust bindings for wlroots. Help from people familiar with Rust would be welcome!

git.sr.ht/~emersion/wlroots-rs

Follow

@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!

Good luck!

@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!

@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.

Sign in to participate in the conversation
Mastodon

The social network of the future: No ads, no corporate surveillance, ethical design, and decentralization! Own your data with Mastodon!