Using the enum Axes to confine Coordinate and Quaternion:
#[derive(Clone)]
pub enum Axes {
Coordinate {
x:
Another difference not mentioned in @Kwarrtz's answer is memory related.
enums can be stored directly on the stack, while a boxed trait will always require the heap. That is, enums are cheap to create, but boxed traits are not.an enum instance will always be as big as its biggest variant (plus a discriminant in most cases), even if you store mostly small variants. This would be a problem in a case like this:
enum Foo {
SmallVariant(bool),
BigVariant([u64; 100]),
}
If you were to store N instances of this type in an vector, the vector would always need N*(100*sizeof:: bytes of memory, even when the vector only contains SmallVariants.
If you were using a boxed trait, the vector would use N * sizeOfFatPointer == N * 2 * sizeof::.