99093b79f1
Sometimes when writing generic code you want to abstract over owning/pointer type so that calling code isn't restricted by one concrete owning/pointer type. This commit makes possible such code: ```rust fn i_will_work_with_arc<T: Into<Arc<MyTy>>>(t: T) { let the_arc = t.into(); // Do something } i_will_work_with_arc(MyTy::new()); i_will_work_with_arc(Box::new(MyTy::new())); let arc_that_i_already_have = Arc::new(MyTy::new()); i_will_work_with_arc(arc_that_i_already_have); ``` Please note that this patch doesn't work with DSTs. Also to mention, I made those impls stable, and I don't know whether they should be actually stable from the beginning. Please tell me if this should be feature-gated. |
||
---|---|---|
.. | ||
arc.rs | ||
boxed_test.rs | ||
boxed.rs | ||
heap.rs | ||
lib.rs | ||
raw_vec.rs | ||
rc.rs |