Skip to content

Commit

Permalink
Add NSUInteger to objc2-foundation
Browse files Browse the repository at this point in the history
  • Loading branch information
madsmtm committed Mar 22, 2022
1 parent b66594d commit d512bf5
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
1 change: 1 addition & 0 deletions objc2-foundation/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
* Added `NSMutableString` object.
* Added basic `NSAttributedString` object.
* Added basic `NSMutableAttributedString` object.
* Added `NSInteger` and `NSUInteger` (type aliases to `isize` and `usize`).

### Changed
* **BREAKING**: Removed the following helper traits in favor of inherent
Expand Down
5 changes: 5 additions & 0 deletions objc2-foundation/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,11 @@ pub use self::thread::{is_main_thread, is_multi_threaded, NSThread};
pub use self::uuid::NSUUID;
pub use self::value::NSValue;

// Available under Foundation, so makes sense here as well:
// https://developer.apple.com/documentation/foundation/numbers_data_and_basic_values?language=objc
#[doc(no_inline)]
pub use objc2::ffi::{NSInteger, NSUInteger};

#[cfg(apple)]
#[link(name = "Foundation", kind = "framework")]
extern "C" {}
Expand Down
8 changes: 4 additions & 4 deletions objc2-foundation/src/range.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ use core::ops::Range;

use objc2::{Encode, Encoding, RefEncode};

use super::NSUInteger;

/// TODO.
///
/// See [Apple's documentation](https://developer.apple.com/documentation/foundation/nsrange?language=objc).
Expand All @@ -10,11 +12,9 @@ use objc2::{Encode, Encoding, RefEncode};
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSRange {
/// The lower bound of the range (inclusive).
// NSUInteger
pub location: usize,
pub location: NSUInteger,
/// The number of items in the range, starting from `location`.
// NSUInteger
pub length: usize,
pub length: NSUInteger,
}

impl NSRange {
Expand Down

0 comments on commit d512bf5

Please sign in to comment.