Twinklebear / tobj

Tiny OBJ Loader in Rust
MIT License
233 stars 47 forks source link

Use AsRef<Path> in load_{obj,mut} #21

Closed alarsyo closed 4 years ago

alarsyo commented 4 years ago

This improves ergonomics, by allowing the user to pass a ref to a string directly instead, with having to create a Path.

This is how File::open() is written, for example.

Although this changes the function's prototype, I don't think it breaks the API ? Any user previously had to pass a &Path, anything else would be rejected, so this should still work.

Twinklebear commented 4 years ago

Looks good @alarsyo , thanks! I'll add a requirement for AsRef<Path> + fmt::Debug so the logging can work as well still. I think it should be safe to assume types implementing AsRef<Path> are likely also fmt::Debug?

alarsyo commented 4 years ago

Whoops, I'd missed the feature flag :) should be fixed now.

I agree it's unlikely that a type implementing AsRef wouldn't implement fmt::Debug. Worst case, this crate isn't 1.0 yet, so nothing's guaranteed, right ? :upside_down_face:

Twinklebear commented 4 years ago

Yea, though I guess at some point I should put out an official "1.0" release. Maybe after this and the other open PRs/Issues I'll tag it as 1.0