I am trying to call foo.into() which is implemented for Into the compiler complains that I need to use type annotations but I have no clue where to put the annotation
I tried
foo.into::<String>()
//and
foo.::<String>::into() //seems this is not even valid rust
but I cant get it to work and for some reason this seems to be kept as a secret in the documentation of rust I cant find anywhere where and how to declare type parameters
// edit, not this... <foo as Into<String>>::into()
// UFCS works:
Into::<String>::into(foo)
// or put the hint on whatever is receiving the value, like:
let x: String = foo.into();
I notice you're just feeding this to a format! though -- can you not feed your type into that directly? That is, does your type have Into<String>, but not Display?
By the way, is there any reason that T: ToString (which is blanket-implemented for T: Display) doesn't imply String: From<T>? Is there any kind of conflict?