summaryrefslogtreecommitdiff
path: root/README.md
diff options
context:
space:
mode:
authorGravatar Sam Atman2025-04-29 13:48:34 -0400
committerGravatar Sam Atman2025-04-29 13:48:34 -0400
commit9ed545ae37dfd1db9758d724e5d10bae5cc00f04 (patch)
tree2ac1c8b198c4114ad6edfcb67cd96224e53001c6 /README.md
parentREADME.md was updated to reflect last changes in API. (diff)
downloadzg-9ed545ae37dfd1db9758d724e5d10bae5cc00f04.tar.gz
zg-9ed545ae37dfd1db9758d724e5d10bae5cc00f04.tar.xz
zg-9ed545ae37dfd1db9758d724e5d10bae5cc00f04.zip
Add result.toOwned() to Normalize.zig
Closes #29 The README is also updated to reflect this change.
Diffstat (limited to 'README.md')
-rw-r--r--README.md15
1 files changed, 13 insertions, 2 deletions
diff --git a/README.md b/README.md
index 5d2318e..1069eef 100644
--- a/README.md
+++ b/README.md
@@ -4,11 +4,11 @@ zg provides Unicode text processing for Zig projects.
4 4
5## Unicode Version 5## Unicode Version
6 6
7The Unicode version supported by zg is 15.1.0. 7The Unicode version supported by zg is `15.1.0`.
8 8
9## Zig Version 9## Zig Version
10 10
11The minimum Zig version required is 0.14 dev. 11The minimum Zig version required is `0.14`.
12 12
13## Integrating zg into your Zig Project 13## Integrating zg into your Zig Project
14 14
@@ -325,6 +325,17 @@ test "Normalization" {
325 try expect(try n.eql(allocator, "foϓ", "fo\u{03D2}\u{0301}")); 325 try expect(try n.eql(allocator, "foϓ", "fo\u{03D2}\u{0301}"));
326} 326}
327``` 327```
328The `Result` returned by normalization functions may or may not be copied from the
329inputs given. For example, an all-ASCII input does not need to be a copy, and will
330be a view of the original slice. Calling `result.deinit(allocator)` will only free
331an allocated `Result`, not one which is a view. Thus it is safe to do
332unconditionally.
333
334This does mean that the validity of a `Result` can depend on the original string
335staying in memory. To ensure that your `Result` is always a copy, you may call
336`try result.toOwned(allocator)`, which will only make a copy if one was not
337already made.
338
328 339
329## Caseless Matching via Case Folding 340## Caseless Matching via Case Folding
330 341