From 354d39cf31b2f2725e2432e1168eddb402970112 Mon Sep 17 00:00:00 2001 From: Kevin Reid Date: Fri, 8 Mar 2024 10:23:43 -0800 Subject: [PATCH] Add `Arbitrary` implementations to inventory types. --- all-is-cubes/src/inv/inventory.rs | 3 +++ all-is-cubes/src/inv/tool.rs | 1 + 2 files changed, 4 insertions(+) diff --git a/all-is-cubes/src/inv/inventory.rs b/all-is-cubes/src/inv/inventory.rs index e1de969b6..654568d97 100644 --- a/all-is-cubes/src/inv/inventory.rs +++ b/all-is-cubes/src/inv/inventory.rs @@ -24,6 +24,7 @@ use crate::universe::{Handle, HandleVisitor, UniverseTransaction, VisitHandles}; /// #[doc = include_str!("../save/serde-warning.md")] #[derive(Clone, Debug, Eq, Hash, PartialEq)] +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[non_exhaustive] pub struct Inventory { /// TODO: This probably shouldn't be public forever. @@ -139,6 +140,7 @@ impl VisitHandles for Inventory { /// The direct child of [`Inventory`]; a container for any number of identical [`Tool`]s. #[derive(Clone, Debug, Eq, Hash, PartialEq)] +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[non_exhaustive] pub enum Slot { /// Slot contains nothing. @@ -281,6 +283,7 @@ impl VisitHandles for Slot { /// stack size and specific deviations from it. #[non_exhaustive] #[derive(Copy, Clone, Debug, Eq, Hash, PartialEq)] +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] pub(crate) enum StackLimit { One, Standard, diff --git a/all-is-cubes/src/inv/tool.rs b/all-is-cubes/src/inv/tool.rs index 13ab5c601..fb8ef05cf 100644 --- a/all-is-cubes/src/inv/tool.rs +++ b/all-is-cubes/src/inv/tool.rs @@ -27,6 +27,7 @@ use crate::universe::{ /// #[doc = include_str!("../save/serde-warning.md")] #[derive(Clone, Debug, Eq, Hash, PartialEq)] +#[cfg_attr(feature = "arbitrary", derive(arbitrary::Arbitrary))] #[non_exhaustive] pub enum Tool { /// “Click”, or “push button”, or generally “activate the function of this”