Skip to content

Commit 3a169d8

Browse files
authored
flower-field: Avoid confusion in hint (#2118)
Using "char" as an abbreviation in this context can lead to confusion. It could be interpreted as the Rust type "char". The size of that type is always 4 bytes. The sentence refers to a character as it is encoded in the UTF-8 string. Motivated by this forum post: https://forum.exercism.org/t/flower-field-explains-char-different-from-rust-docs/20304
1 parent 57a6705 commit 3a169d8

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

exercises/practice/flower-field/.docs/instructions.append.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
## Performance Hint
44

55
All the inputs and outputs are in ASCII.
6-
Rust `String`s and `&str` are utf8, so while one might expect `"Hello".chars()` to be simple, it actually has to check each char to see if it's 1, 2, 3 or 4 `u8`s long.
6+
Rust `String`s and `&str` are utf8, so while one might expect `"Hello".chars()` to be simple, it actually has to check each character to see if it's 1, 2, 3 or 4 `u8`s long.
77
If we know a `&str` is ASCII then we can call `.as_bytes()` and refer to the underlying data as a `&[u8]` (byte slice).
88
Iterating over a slice of ASCII bytes is much quicker as there are no codepoints involved - every ASCII byte is one `u8` long.
99

0 commit comments

Comments
 (0)