Skip to content

Commit

Permalink
glib: refactor GStr and GString constructors
Browse files Browse the repository at this point in the history
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.
  • Loading branch information
jf2048 authored and sdroege committed Dec 24, 2022
1 parent 02ade78 commit ed25376
Show file tree
Hide file tree
Showing 3 changed files with 642 additions and 118 deletions.
1 change: 1 addition & 0 deletions glib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ rs-log = { package = "log", version = "0.4", optional = true }
smallvec = "1.0"
thiserror = "1"
gio_ffi = { package = "gio-sys", path = "../gio/sys", optional = true }
memchr = "2.5.0"

[dev-dependencies]
tempfile = "3"
Expand Down
Loading

0 comments on commit ed25376

Please sign in to comment.