pub struct UseItemContext<'a> {
pub player: &'a Player,
pub hand: InteractionHand,
pub world: &'a Arc<World>,
pub inv: InventoryAccess,
}Expand description
Context for using an item (general usage).
Immutable fields (player, hand, world) can be accessed freely while
inv is mutably borrowed.
Fields§
§player: &'a PlayerThe player using the item.
hand: InteractionHandWhich hand the item is in.
world: &'a Arc<World>The world where the interaction is happening.
inv: InventoryAccessMutable inventory access.
Implementations§
Source§impl<'a> UseItemContext<'a>
impl<'a> UseItemContext<'a>
Sourcepub const fn new(
player: &'a Player,
hand: InteractionHand,
world: &'a Arc<World>,
inventory: Shared<PlayerInventory>,
) -> Self
pub const fn new( player: &'a Player, hand: InteractionHand, world: &'a Arc<World>, inventory: Shared<PlayerInventory>, ) -> Self
Creates a new UseItemContext.
Auto Trait Implementations§
impl<'a> !RefUnwindSafe for UseItemContext<'a>
impl<'a> !UnwindSafe for UseItemContext<'a>
impl<'a> Freeze for UseItemContext<'a>
impl<'a> Send for UseItemContext<'a>
impl<'a> Sync for UseItemContext<'a>
impl<'a> Unpin for UseItemContext<'a>
impl<'a> UnsafeUnpin for UseItemContext<'a>
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<>>