pub enum SlotDisplay {
Empty,
AnyFuel,
WithAnyPotion(WithAnyPotionSlotDisplay),
OnlyWithComponent(OnlyWithComponentSlotDisplay),
Item(ItemSlotDisplay),
ItemStack(ItemStackSlotDisplay),
Tag(TagSlotDisplay),
Dyed(DyedSlotDisplay),
SmithingTrim(SmithingTrimSlotDisplay),
WithRemainder(WithRemainderSlotDisplay),
Composite(CompositeSlotDisplay),
}Expand description
Description of a recipe ingredient slot for use by the client.
The enum variant determines both the registry type ID and the exact payload, so mismatched type IDs and payloads cannot be represented in memory. See the official Slot Display structure documentation.
§Examples
use mcproto_types::{
CompositeSlotDisplay, ItemSlotDisplay, PrefixedArray, SlotDisplay, TypeCodec, VarInt,
};
let display = SlotDisplay::Composite(CompositeSlotDisplay {
options: PrefixedArray(vec![
SlotDisplay::AnyFuel,
SlotDisplay::Item(ItemSlotDisplay { item_type_id: VarInt(5) }),
]),
});
let mut encoded = Vec::new();
display.encode(&mut encoded)?;
let mut input = encoded.as_slice();
assert_eq!(SlotDisplay::decode(&mut input)?, display);Variants§
Empty
AnyFuel
WithAnyPotion(WithAnyPotionSlotDisplay)
OnlyWithComponent(OnlyWithComponentSlotDisplay)
Item(ItemSlotDisplay)
ItemStack(ItemStackSlotDisplay)
Tag(TagSlotDisplay)
Dyed(DyedSlotDisplay)
SmithingTrim(SmithingTrimSlotDisplay)
WithRemainder(WithRemainderSlotDisplay)
Composite(CompositeSlotDisplay)
Trait Implementations§
Source§impl Clone for SlotDisplay
impl Clone for SlotDisplay
Source§fn clone(&self) -> SlotDisplay
fn clone(&self) -> SlotDisplay
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for SlotDisplay
impl Debug for SlotDisplay
Source§impl PartialEq for SlotDisplay
impl PartialEq for SlotDisplay
impl StructuralPartialEq for SlotDisplay
Auto Trait Implementations§
impl Freeze for SlotDisplay
impl RefUnwindSafe for SlotDisplay
impl Send for SlotDisplay
impl Sync for SlotDisplay
impl Unpin for SlotDisplay
impl UnsafeUnpin for SlotDisplay
impl UnwindSafe for SlotDisplay
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> ContextualCodec for Twhere
T: TypeCodec,
impl<T> ContextualCodec for Twhere
T: TypeCodec,
Source§fn encode_with_context(
&self,
writer: &mut impl Write,
_context: &Context,
) -> Result<(), CodecError>
fn encode_with_context( &self, writer: &mut impl Write, _context: &Context, ) -> Result<(), CodecError>
Encodes this value using context supplied by its enclosing structure.
Source§fn decode_with_context(
reader: &mut impl Read,
_context: &Context,
) -> Result<T, CodecError>where
T: Sized,
fn decode_with_context(
reader: &mut impl Read,
_context: &Context,
) -> Result<T, CodecError>where
T: Sized,
Decodes this value using context supplied by its enclosing structure.