Expand description
§Derive Weak
Implements derive macro #[derive(Weak)] which creates ‘weak’ counterpart for the structure. I.e. when original structure
contains reference counting pointers (Arc, Rc), the corresponding weak structure contains the weak variants
of these pointers (std::sync::Weak, std::rc::Weak).
This may be useful when it’s inconvenient to store some data under refernce counting pointer, due to performance or ergonomic reasons.
Derive Macros§
- Weak
#[derive(Weak)]for struct typeFoogenerates new typeWFoo(name can be changed) with reference counting fields replaced to their non-owning (weak) pairs. Methodsdowngrade() -> WFooandupgrade() -> Option<Foo>added toFooandWFoorespectively.