Non-binary Rust: Between Safe and Unsafe - Boxy Uwu | EuroRust 2024
When writing unsafe code it is often easy to throw away a lot of the guardrails that safe Rust provides: the language stops helping you write your code, and you take on the burden of being the compiler and ensuring that all the invariants are upheld. It might feel like you’re either writing safe Rust or you’re responsible for doing everything yourself. In practice though it is possible to design your unsafe code to find a middle ground. You can offload some of the burden back onto the type system, like in safe Rust, while still being able to use the required unsafe functionality. Learning from my experience in refactoring and improving large amounts of unsafe code in Bevy’s ECS, I will explore this middle ground, leveraging the borrow checker and the type system to recover as many guardrails as we can. *About Boxy Uwu* Boxy is a member of the Rust Project, where she maintains the type system in her spare time. Before this she worked on the Bevy game engine’s unsafe code ensuring it’s soundness and long term maintainability. -------------------- *EuroRust 2024* – the yearly 2 day conference for the European Rust community ➡️ https://eurorust.eu _EuroRust is organized by Mainmatter, experts in Rust and distributed systems_ ➡️ https://mainmatter.com/rust/
Discussion (0)
Join the discussion!
Subscribe to post comments and join our community of developers.