[SOLVED] Error with using Option in a Struct

Hello guys, I am a newbie rustacean and I need your help. I do not understannd why is the following error appearing:

Because you're giving it a None, rustc can't figure out which type the P in Option<P> is.

You could write something like:

let opt: Option<&str> = None;
let a = Sample::new(opt);

or shorter:

let a = Sample::new(None::<&str>);
1 Like

Thank you! I couldn't figure it out.