diff options
| author | mat <git@matdoes.dev> | 2024-01-06 18:16:11 -0600 |
|---|---|---|
| committer | mat <git@matdoes.dev> | 2024-01-06 18:16:11 -0600 |
| commit | 5ea127114582e3320381d09e880f6a433ccb8710 (patch) | |
| tree | 0a6f56ecf94260334a11ce81b532226346cb86ba /azalea-inventory/src | |
| parent | 1347f3549282397be6a46b8b7cb76a7900d0690a (diff) | |
| download | azalea-drasl-5ea127114582e3320381d09e880f6a433ccb8710.tar.xz | |
add doc comment about d=
Diffstat (limited to 'azalea-inventory/src')
| -rw-r--r-- | azalea-inventory/src/slot.rs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/azalea-inventory/src/slot.rs b/azalea-inventory/src/slot.rs index 814b6c37..c4f8da05 100644 --- a/azalea-inventory/src/slot.rs +++ b/azalea-inventory/src/slot.rs @@ -71,6 +71,14 @@ impl ItemSlot { } } } + + /// Convert this slot into an [`ItemSlotData`], if it's present. + pub fn as_present(&self) -> Option<&ItemSlotData> { + match self { + ItemSlot::Empty => None, + ItemSlot::Present(i) => Some(i), + } + } } /// An item in an inventory, with a count and NBT. Usually you want [`ItemSlot`] |
