diff --git a/all-is-cubes/src/inv/tool.rs b/all-is-cubes/src/inv/tool.rs index d85d30edc..ba52917bf 100644 --- a/all-is-cubes/src/inv/tool.rs +++ b/all-is-cubes/src/inv/tool.rs @@ -540,6 +540,12 @@ impl EphemeralOpaque { Self(Some(contents)) } + /// Constructs an [`EphemeralOpaque`] that is already defunct + /// (holds no value). + pub fn defunct() -> Self { + Self(None) + } + /// Get a reference to the value if it still exists. pub fn try_ref(&self) -> Option<&T> { self.0.as_deref()