Up until now the Item
type looked like this:
pub enum Item {
Material(Material),
Structure(Structure),
...
}
While Structure
is either one of the concrete buildings:
pub enum Structure {
Belt(Belt),
Arm(Arm),
LongArm(LongArm),
Source(Source),
Target(Target),
...
}
Since those types also track values such as their cooldown and content it becomes very wasteful and complicated to work with Item
. A Belt
could transport another Belt
which could have another Structure
as content itself.
This is why until now most Structure
s were basically unable to hold Item
and only worked with Material
. Also some of the additional information is irrelevant when e.g. an Item
is transported on a Belt
.
I therefore introduced SimpleStructure
which is just a traditional enum without any additional data per variant.
pub enum SimpleStructure {
Belt,
Arm,
LongArm,
Source,
Target,
...
}
Item
now updated to use SimpleStructure
instead of Structure
:
pub enum Item {
Material(Material),
Structure(SimpleStructure),
...
}
For easier usage I also added conversion methods such as:
impl From<SimpleStructure> for Structure {
...
}
impl From<&Structure> for SimpleStructure {
...
}