mirror of
https://github.com/slint-ui/slint.git
synced 2025-10-02 14:51:15 +00:00
Use a free-standing function for the string_view to slice conversion
This commit is contained in:
parent
0c21008861
commit
3bb4b87bc7
2 changed files with 11 additions and 11 deletions
|
@ -103,15 +103,15 @@ fn gen_corelib(root_dir: &Path, include_dir: &Path) -> anyhow::Result<()> {
|
|||
|
||||
let mut string_config = config.clone();
|
||||
string_config.export.exclude = vec!["SharedString".into()];
|
||||
string_config.export.body.insert(
|
||||
"Slice".to_owned(),
|
||||
" static Slice<T> from_string(std::string_view str) {
|
||||
return {
|
||||
string_config.trailer = Some(
|
||||
"namespace sixtyfps::private_api {
|
||||
cbindgen_private::Slice<uint8_t> string_to_slice(std::string_view str) {
|
||||
return cbindgen_private::Slice<uint8_t> {
|
||||
const_cast<unsigned char *>(reinterpret_cast<const unsigned char *>(str.data())),
|
||||
str.size()
|
||||
};
|
||||
}"
|
||||
.to_owned(),
|
||||
}
|
||||
}".to_owned(),
|
||||
);
|
||||
|
||||
cbindgen::Builder::new()
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue