Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> We need to fix the fact that you can't write `.into::<u64>()` to disambiguate types.

Yes, that would be great. In the meantime, if you can't wait but want something like this, you can DIY it via an extension trait.

It's very easy to write it yourself, this is all it takes:

  pub trait To {
      fn to<T>(self) -> T where Self: Into<T> {
          <Self as Into<T>>::into(self)
      }
  }
Now whenever this trait is in scope, you get to simply do .to::<u64>() and it does exactly what Into does. If you prefer adding a tiny dependency over copy-pasting code, I've also published a crate that provides this: https://crates.io/crates/to_method


Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: