Skip to content

Commit 41e8f84

Browse files
committed
Add len_utf16 methods
1 parent 246fe94 commit 41e8f84

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

objc2/CHANGELOG_FOUNDATION.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
1515
* Added `NSNotFound`.
1616
* Added `NSBundle`.
1717
* Added `NSTimeInterval`.
18+
* Added `NSString::len_utf16` and `NSAttributedString::len_utf16`.
1819

1920

2021
## objc2 0.3.0-beta.2 - 2022-08-28

objc2/src/foundation/attributed_string.rs

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,9 +85,7 @@ extern_methods!(
8585
/// Alias for `self.string().len_utf16()`.
8686
#[doc(alias = "length")]
8787
#[sel(length)]
88-
#[allow(unused)]
89-
// TODO: Finish this
90-
fn len_utf16(&self) -> usize;
88+
pub fn len_utf16(&self) -> usize;
9189

9290
// /// TODO
9391
// ///

objc2/src/foundation/string.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -63,13 +63,12 @@ extern_methods!(
6363
unsafe { msg_send![self, lengthOfBytesUsingEncoding: UTF8_ENCODING] }
6464
}
6565

66-
/// The number of UTF-16 code units in `self`.
66+
/// The number of UTF-16 code units in the string.
6767
///
6868
/// See also [`NSString::len`].
6969
#[doc(alias = "length")]
70-
// TODO: Finish this
7170
#[sel(length)]
72-
fn len_utf16(&self) -> usize;
71+
pub fn len_utf16(&self) -> usize;
7372

7473
pub fn is_empty(&self) -> bool {
7574
// TODO: lengthOfBytesUsingEncoding: might sometimes return 0 for

0 commit comments

Comments
 (0)