fbxcel-dom icon indicating copy to clipboard operation
fbxcel-dom copied to clipboard

Avoid Deref polymorphism

Open lo48576 opened this issue 4 years ago • 1 comments

std::ops::Deref should be only used for smart pointer types, and it is considered as an anti pattern to use it to "derive" parent type.

Deref should only be implemented for smart pointers to avoid confusion.

--- https://doc.rust-lang.org/stable/std/ops/trait.Deref.html

Currently, some object types abuse Deref trait, and this use of Deref should be removed in future.

  • v7400::object::**::*Handle (including ObjectHandle)
    • So many types!
  • v7400::data::mesh::layer::*Handle (including tree::v7400::NodeHandle)

lo48576 avatar Mar 25 '21 20:03 lo48576

Not the biggest fan of macros, but delegate! might be useful. https://crates.io/crates/delegate

Kleptine avatar Mar 28 '21 20:03 Kleptine