pub struct ContainerHandleRef { /* private fields */ }
Expand description
A handle to a container that may be open. This does not close the container
when it’s dropped. See ContainerHandle
if that behavior is desired.
Implementations§
Source§impl ContainerHandleRef
impl ContainerHandleRef
pub fn close(&self)
Sourcepub fn id(&self) -> u8
pub fn id(&self) -> u8
Get the id of the container. If this is 0, that means it’s the player’s inventory. Otherwise, the number isn’t really meaningful since only one container can be open at a time.
Returns the menu of the container. If the container is closed, this
will return None
.
Note that any modifications you make to the Menu
you’re given will not
actually cause any packets to be sent. If you’re trying to modify your
inventory, use ContainerHandle::click
instead
Sourcepub fn contents(&self) -> Option<Vec<ItemSlot>>
pub fn contents(&self) -> Option<Vec<ItemSlot>>
Returns the item slots in the container, not including the player’s
inventory. If the container is closed, this will return None
.
pub fn click(&self, operation: impl Into<ClickOperation>)
Trait Implementations§
Auto Trait Implementations§
impl Freeze for ContainerHandleRef
impl !RefUnwindSafe for ContainerHandleRef
impl Send for ContainerHandleRef
impl Sync for ContainerHandleRef
impl Unpin for ContainerHandleRef
impl !UnwindSafe for ContainerHandleRef
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> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.§impl<T> Downcast for Twhere
T: AsAny + ?Sized,
impl<T> Downcast for Twhere
T: AsAny + ?Sized,
§fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
fn downcast_ref<T>(&self) -> Option<&T>where
T: AsAny,
Forward to the method defined on the type
Any
.§fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
fn downcast_mut<T>(&mut self) -> Option<&mut T>where
T: AsAny,
Forward to the method defined on the type
Any
.