pub enum StoneError {
UnknownStone(StoneTemplateId),
SlotHasNoSockets {
item_type: ItemType,
},
WrongCollection {
socket: StoneSocketSlot,
expected: StoneKind,
actual: StoneKind,
},
SocketLocked {
item_type: ItemType,
socket: StoneSocketSlot,
},
AlreadySocketed(StoneTemplateId),
NotSocketed(StoneTemplateId),
NotEnoughCopies {
stone: StoneTemplateId,
level: i64,
required: i64,
held: i64,
},
AlreadyMaxLevel(StoneTemplateId, i64),
NoUpgradeStep(i64),
}Expand description
Why an insert/remove/upgrade was refused. Every variant is a rule from the design doc, so the caller can report the actual reason instead of a generic failure.
Variants§
UnknownStone(StoneTemplateId)
SlotHasNoSockets
WrongCollection
SocketLocked
AlreadySocketed(StoneTemplateId)
One instance per template means one socket per template: this is also how “the same stone in two slots” is refused.
NotSocketed(StoneTemplateId)
NotEnoughCopies
AlreadyMaxLevel(StoneTemplateId, i64)
NoUpgradeStep(i64)
The upgrade ladder has no rung for the level being bought.
GameConfig::validate_stones rules this out at load time, so it means a
config loaded past validation — refuse rather than guess a cost.
Trait Implementations§
Source§impl Debug for StoneError
impl Debug for StoneError
Source§impl Display for StoneError
impl Display for StoneError
Source§impl Error for StoneError
impl Error for StoneError
1.30.0 · Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0: use the Display impl or to_string()
Source§impl PartialEq for StoneError
impl PartialEq for StoneError
impl Eq for StoneError
impl StructuralPartialEq for StoneError
Auto Trait Implementations§
impl Freeze for StoneError
impl RefUnwindSafe for StoneError
impl Send for StoneError
impl Sync for StoneError
impl Unpin for StoneError
impl UnwindSafe for StoneError
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