pub(crate) struct MenuLayout {
pub(crate) routes: Vec<Route>,
pub(crate) drain_sections: Vec<Range<usize>>,
}Expand description
Static layout of a built menu: section ranges and the shift-click route table.
Fields§
§routes: Vec<Route>§drain_sections: Vec<Range<usize>>Implementations§
Source§impl MenuLayout
impl MenuLayout
Sourcepub fn return_drained_items(
&self,
behavior: &MenuBehavior,
player: &Player,
return_to_inventory: bool,
)
pub fn return_drained_items( &self, behavior: &MenuBehavior, player: &Player, return_to_inventory: bool, )
Returns every item in the drain sections to the player, emptying those slots.
When return_to_inventory is false the items are dropped into the world.
Sourcepub fn quick_move(
&self,
behavior: &MenuBehavior,
guard: &mut ContainerLockGuard,
slot_index: usize,
player: &Player,
) -> ItemStack
pub fn quick_move( &self, behavior: &MenuBehavior, guard: &mut ContainerLockGuard, slot_index: usize, player: &Player, ) -> ItemStack
Generic shift-click for slot_index via the route table.
Returns the item originally in the slot, or empty if nothing moved.
Auto Trait Implementations§
impl Freeze for MenuLayout
impl RefUnwindSafe for MenuLayout
impl Send for MenuLayout
impl Sync for MenuLayout
impl Unpin for MenuLayout
impl UnsafeUnpin for MenuLayout
impl UnwindSafe for MenuLayout
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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreWraps this value in an
Arc<SyncMutex<>>