Skip to content

Commit a4a5383

Browse files
committed
Improve ns_string! documentation
1 parent 01d1776 commit a4a5383

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

objc2-foundation/src/__string_macro.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -207,20 +207,18 @@ const fn decode_utf8(s: &[u8], i: usize) -> (usize, u32) {
207207
///
208208
/// # Unicode Strings
209209
///
210-
/// In Objective-C, non-ASCII strings are UTF-16. However, Rust strings are
211-
/// UTF-8.
212-
///
213-
/// This macro transcodes non-ASCII strings to UTF-16:
210+
/// An NSString can contain strings with many different encodings, including
211+
/// ASCII, UTF-8, UTF-16, and so on. This macro automatically converts your
212+
/// string to the most efficient encoding, you don't have to do anything!
214213
///
215214
/// ```
216215
/// # use objc2_foundation::{ns_string, NSString};
217216
/// static HELLO_RU: &NSString = ns_string!("Привет");
218-
///
219217
/// assert_eq!(HELLO_RU.to_string(), "Привет");
220218
/// ```
221219
///
222220
/// Note that because this is implemented with `const` evaluation, massive
223-
/// strings can increase compile time and even hit the `const` evaluation
221+
/// strings can increase compile time, and may even hit the `const` evaluation
224222
/// limit.
225223
///
226224
///
@@ -429,6 +427,7 @@ mod tests {
429427
"\0",
430428
"\0\x01\x02\x03\x04\x05\x06\x07\x08\x09",
431429
// "\u{feff}", // TODO
430+
include_str!("__string_macro.rs"),
432431
}
433432
}
434433

0 commit comments

Comments
 (0)