Ogeon@programming.devtoRust@programming.dev•Allow argument in macro to be Option<T> or T
1·
5 months agoRight, there may be too many unknowns involved. 🤔
Right, there may be too many unknowns involved. 🤔
deleted by creator
Option<T>
has a From<T>
implementation that lets you write Option::from($file_path).map(|path| path.to_string())
to accept both cases in the same expression.
https://doc.rust-lang.org/std/option/enum.Option.html#impl-From<T>-for-Option<T>
https://youtube.com/shorts/c6kNX2HusaM