pub fn remove_item(&mut self, item: Item) -> NRResult<Item> {
        let target_item = self.items.iter().position(|i| i.name == item.name);
        match target_item {
            Some(item_index) => Ok(self.items.remove(item_index)),
            None => Err(NoItem.into()),
        }
    }
/// This function removes an item from the storage
/// if availabl and returns the item removed. This
/// is so that the same item can be added to another
/// storage, for example when the user drops an item
/// from their inventory or picks up an item from
/// the room.
This function removes an item from the storage
if availabl and returns the item removed. This
is so that the same item can be added to another
storage, for example when the user drops an item
from their inventory or picks up an item from
the room.
This function removes an item from the storage if availabl and returns the item removed . This is so that the same item can be added to another storage for example when the user drops an item from their inventory or picks up an item from the room .
pub fn remove_item(&mut self, item: Item) -> NRResult<Item> {
        let target_item = self.items.iter().position(|i| i.name == item.name);
        match target_item {
            Some(item_index) => Ok(self.items.remove(item_index)),
            None => Err(NoItem.into()),
        }
    }
pub fn remove_item ( & mut self , item : Item ) -> NRResult < Item > { let target_item = self . items . iter ( ) . position ( | i | i . name == item . name ) ; match target_item { Some ( item_index ) => Ok ( self . items . remove ( item_index ) ) , None => Err ( NoItem . into ( ) ) , } }
This function removes an item from the storage
if availabl and returns the item removed.
This function removes an item from the storage if availabl and returns the item removed .
&mut self
item
Item
&mut self
item
Item