maciejhirsz / beef

Faster, more compact implementation of std::borrow::Cow

Home Page:https://crates.io/crates/beef

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Support for `Path`/`PathBuf`

Alxandr opened this issue · comments

As far as I can see, I'm not able to put own/std types into a beefcow except those that are explicitly enabled in this library. So would it be possible to add support for Path/PathBuf?

Sadly neither PathBuf or OsString exposes *_raw_parts methods, or any way to get a byte pointer or some such, so this has to sit on the backburner until std is extended.

Yeah. I looked at implementing it myself the other day and ran into the same issue. Was hoping that more eyes on the issue might figure out something clever :P. Maybe if there exists some other type than PathBuf that is AsRef<Path> that does allow getting parts?

The only such type that can correctly map it is OsStr/OsSTring. The os_str_bytes crate might be of some use here, will have to dig in further.