rust-bindgen icon indicating copy to clipboard operation
rust-bindgen copied to clipboard

Allow passing `AsRef<OsStr>` as valid `clang_arg` value.

Open i509VCB opened this issue 3 years ago • 1 comments

This allows more easily setting arguments that may come from an OsString like a path from pkg-config

i509VCB avatar Jul 07 '22 21:07 i509VCB

Seems reasonable, would take a patch if it doesn't break backwards compat. Thanks.

emilio avatar Jul 25 '22 09:07 emilio

I think this interacts poorly with clang because it expects CStrings everywhere. On unix-like platforms this is not an issue as we can turn OsStrings into bytes and then into CStrings without issue. But on windows we cannot do that as we can only get wide slices.

pvdrz avatar Aug 26 '22 21:08 pvdrz

This discussion is adjacent to https://github.com/rust-lang/rust-bindgen/issues/1297 as we need to figure out how to handle lossy conversion between string types. I'm closing this issue as the #1297 has a more developed discussion.

pvdrz avatar Aug 31 '22 21:08 pvdrz