dcampbell24 / iup-rust

Rust binding for IUP
MIT License
44 stars 13 forks source link

From Element to Handle #17

Closed thelink2012 closed 9 years ago

thelink2012 commented 9 years ago

There is a impl From<E: Element> for Handle implemented (which allows Handle::from(elem) and at most elem.into()) to allow a conversion between specialized objects to a basic elemental handle and there's also a pub fn from_element<E: Element>(elem: E) -> Handle implemented as a constructor of the Handle object.

Should the from_element constructor be removed in favor of From trait?

Note there are other from-like methods in the Element trait (Handle is also a Element), those shouldn't be removed but it's good to think they exist in relation to from_element:

thelink2012 commented 9 years ago

/cc @dcampbell24

dcampbell24 commented 9 years ago

Yeah, not a high priority, but the From trait is now considered more idiomatic way of doing things.