pub struct DefaultSlot<'a, I: Item, II: ItemInstance<I>> {
pub item_instance: Option<II>,
pub modified: bool,
pub phantom: PhantomData<&'a I>,
}Expand description
A sample slot struct used for testing.
A significant reduction in boiler plate would come from making your own slot non-generic. For the purpose of an example, I decided that I wanted mine to be generic to prove it was possible if for some reason you need that functionality.
The main thing you probably want to change other than that is the transfer method.
some methods like half_stack_split and combine_stack would be pretty useful.
Fields§
§item_instance: Option<II>§modified: bool§phantom: PhantomData<&'a I>Trait Implementations§
Source§impl<'a, I: Item, II: ItemInstance<I> + Debug> Debug for DefaultSlot<'a, I, II>
impl<'a, I: Item, II: ItemInstance<I> + Debug> Debug for DefaultSlot<'a, I, II>
Source§impl<'a, I: Item, II: ItemInstance<I> + Sized + Clone> Slot<I, II> for DefaultSlot<'a, I, II>
impl<'a, I: Item, II: ItemInstance<I> + Sized + Clone> Slot<I, II> for DefaultSlot<'a, I, II>
Source§fn item_instance(&self) -> Option<II>
fn item_instance(&self) -> Option<II>
Get the item instance stored by this slot.
Source§fn set_item_instance(&mut self, item_instance: &Option<II>)
fn set_item_instance(&mut self, item_instance: &Option<II>)
Set the item instance stored by this slot.
Source§fn set_modified(&mut self, modified: bool)
fn set_modified(&mut self, modified: bool)
Sets whether the slots contents have been modified.
fn new(item_instance: Option<II>) -> Self
Auto Trait Implementations§
impl<'a, I, II> Freeze for DefaultSlot<'a, I, II>where
II: Freeze,
impl<'a, I, II> RefUnwindSafe for DefaultSlot<'a, I, II>where
II: RefUnwindSafe,
I: RefUnwindSafe,
impl<'a, I, II> Send for DefaultSlot<'a, I, II>
impl<'a, I, II> Sync for DefaultSlot<'a, I, II>
impl<'a, I, II> Unpin for DefaultSlot<'a, I, II>where
II: Unpin,
impl<'a, I, II> UnsafeUnpin for DefaultSlot<'a, I, II>where
II: UnsafeUnpin,
impl<'a, I, II> UnwindSafe for DefaultSlot<'a, I, II>where
II: UnwindSafe,
I: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more