Skip to content

Commit 3c82651

Browse files
jf2048sdroege
authored andcommitted
glib: refactor GStr and GString constructors
Optimizes GString to avoid unnecessary checking for interior nul bytes. Interior nul bytes will now only be checked upon request. When converting to C strings, the string will always get truncated to the first nul byte. Since GString can now contain interior nul bytes in some circumstances, its interior representation is now Option<Box<str>>. Also adds custom error types for conversions.
1 parent 291607c commit 3c82651

File tree

3 files changed

+642
-118
lines changed

3 files changed

+642
-118
lines changed

glib/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ rs-log = { package = "log", version = "0.4", optional = true }
3434
smallvec = "1.0"
3535
thiserror = "1"
3636
gio_ffi = { package = "gio-sys", path = "../gio/sys", optional = true }
37+
memchr = "2.5.0"
3738

3839
[dev-dependencies]
3940
tempfile = "3"

0 commit comments

Comments
 (0)