To be completely honest, I probably won’t use it again, at least for a while. While it’s nice to work with most of the time, I ran into a lot of weird niche issues that I had to either work around or come up with some hack to achieve the same effect, which was unfortunate. As a random example, trying to scroll to the top of the document every time a state was changed would not trigger the scroll consistently, making it pretty useless.
For a site like this, it would probably have been easier to just use a JS framework, or finally go and learn htmx
As someone else said I think the shadowing works well here.
I do also wanna mention that depending on why you need this conversion, you could use
impl AsRef<std::path::Path>
for your function signature so it can accept&PathBuf
or&Path
. Then, just use that argument with e.g.p.as_ref()
to get a&Path
in the function body