lib.rs (665B)
1 /// Example 1: fighting the borrow check with refcell 2 pub mod ownership_bad_example; 3 4 /// Example 2: make it work within the ownership rules 5 pub mod ownership_better_example; 6 7 /// Example 3: cloning - using clone() everywhere as a clone hammer 8 pub mod cloning_bad_example; 9 10 /// Example 4: cloning - work within the ownership and lifetime rules 11 pub mod cloning_better_example; 12 13 /// Example 5: smart pointers - over-engineer with smart pointers and wrap 14 /// everything in Rc<RefCell<...>> 15 pub mod smart_pointers_bad_example; 16 17 /// Example 6: smart pointers - design a system by thinking about ownership 18 /// and data flow upfront 19 pub mod smart_pointers_better_example;