Not sure if it is the right place to ask, but I’ll try 
I’m struggling with default trait implementation in type parameters of structure, which stores it as PhantomData.
Here is the snippet that illustrates the problem:
use std::marker::PhantomData;
trait Trait {}
struct Struct;
impl Trait for Struct {}
struct GenericStruct<T: Trait = Struct> {
_marker: PhantomData<T>
}
impl<T: Trait> GenericStruct<T> {
fn new() -> Self {
GenericStruct {
_marker: PhantomData
}
}
}
fn main() {
GenericStruct::new();
}
https://play.rust-lang.org/?gist=7b3c32d39600a2de0df08593ced9134d&version=stable&mode=debug
Rustc says that it cannot infer the type.
Why so? And what can I do in this situation to not to have an API that asks the user to make explicit annotation for the default implementation of the trait I ship within the crate?
Thanks!