Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Kudos! I've been successfully applying this pattern in a bunch of places and am happy to report that it is very useful and easy to reason about. It works well in any context where your object access is mediated... Mutex & RwLock, Rc and Arc, etc.

I can recommend the ambassador crate to go with this pattern -- it can be very useful for avoiding boilerplate for the newtype struct.

Really the hardest part is naming... I've also settled on FooInner, but I'm still not entirely happy with that convention.



Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: