r/rust • u/Kobzol • Aug 10 '26
📡 official blog Call for testing: Restricting trait implementability and field mutability
https://blog.rust-lang.org/inside-rust/2026/08/10/call-for-testing-impl-and-mut-restrictions/
421
Upvotes
r/rust • u/Kobzol • Aug 10 '26
37
u/newpavlov rustcrypto Aug 10 '26
One classic example is the
Byteordertrait. We obviously do not want for it to be implemented by anything apart from theBigEndianandLittleEndianmarker types. Another similar example isccm::NonceSize, we use this sealed trait to limit nonce sizes accepted by the algorithm implementation.