Added rustdoc for MultiFruit extract function (#1369)

This commit is contained in:
Paul Masurel
2022-05-11 11:41:39 +09:00
committed by GitHub
parent 617ba1f0c0
commit 749395bbb8

View File

@@ -87,6 +87,10 @@ pub struct FruitHandle<TFruit: Fruit> {
}
impl<TFruit: Fruit> FruitHandle<TFruit> {
// Extract a typed fruit off a multifruit.
//
// This function involves downcasting and can panic if the multifruit was
// created using faulty code.
pub fn extract(self, fruits: &mut MultiFruit) -> TFruit {
let boxed_fruit = fruits.sub_fruits[self.pos].take().expect("");
*boxed_fruit