lo48576 / fbxcel-dom

FBX DOM library for Rust. // See https://github.com/lo48576/fbx-viewer for working example application // rework (total rewrite) is planned
Apache License 2.0
24 stars 10 forks source link

Avoid Deref polymorphism #6

Open lo48576 opened 3 years ago

lo48576 commented 3 years ago

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.

Kleptine commented 3 years ago

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