silvia-odwyer / photon

⚡ Rust/WebAssembly image processing library
https://silvia-odwyer.github.io/photon
Apache License 2.0
2.72k stars 154 forks source link

Change function interacting with filesystem to use `impl AsRef<Path>` instead of `&str` #191

Closed Turtyo closed 3 weeks ago

Turtyo commented 1 month ago

Description

It is common for Rust functions interacting with the filesystem to not require &str (which is pretty cumbersome), but rather anything that can be referenced as a Path (which includes &str) Examples:

Impact

Implementation

I'm not sure, but it's likely we can just copy what is done by the examples I gave above

silvia-odwyer commented 4 weeks ago

@Turtyo Sounds great! This would be very useful for those using a Path instead of &str. And since str already implements AsRef as you mentioned, it will cover both use cases.

silvia-odwyer commented 3 weeks ago

@Turtyo I've implemented this feature, and updated the native functions to accept parameters that can be referenced as a Path. Since this is completed, I will close this issue ✅

Turtyo commented 3 weeks ago

@silvia-odwyer Thank you !