valence_command/parsers/
inventory_slot.rs

1use bevy_derive::Deref;
2
3use super::Parser;
4use crate::parsers::{CommandArg, CommandArgParseError, ParseInput};
5
6#[derive(Debug, Clone, Copy, PartialEq, Eq, Default, Deref)]
7pub struct InventorySlot(pub u32);
8
9impl CommandArg for InventorySlot {
10    fn parse_arg(input: &mut ParseInput) -> Result<Self, CommandArgParseError> {
11        input.skip_whitespace();
12        let slot = u32::parse_arg(input)?;
13
14        Ok(InventorySlot(slot))
15    }
16
17    fn display() -> Parser {
18        Parser::ItemSlot
19    }
20}