Skip to content

Commit

Permalink
Add ffi::NSComparisonResult
Browse files Browse the repository at this point in the history
  • Loading branch information
madsmtm committed Dec 22, 2021
1 parent 885935f commit 1d4b7fd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 7 deletions.
11 changes: 7 additions & 4 deletions objc2-foundation-sys/src/generated_others_shim.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,17 @@
use core::mem::ManuallyDrop;
use core::ptr::NonNull;

use std::os::raw::{c_char, c_int, c_longlong, c_schar, c_ulong, c_ushort, c_void};

use objc2::ffi::{NSInteger, NSUInteger};
use objc2::rc::{Id, Unknown};
use objc2::runtime::{Bool, Object};
use objc2::runtime::Object;
use objc2::{class, msg_send, Encoding, Message, RefEncode};

use crate::{Autoreleased, NSCoder, NSObject, NSRange, NSString};
use crate::{Autoreleased, NSCoder, NSObject, NSRange};

pub const NSComparisonResult_NSOrderedAscending: NSComparisonResult = -1;
pub const NSComparisonResult_NSOrderedSame: NSComparisonResult = 0;
pub const NSComparisonResult_NSOrderedDescending: NSComparisonResult = 1;
pub type NSComparisonResult = NSInteger;

#[repr(transparent)]
pub struct NSArray(NSObject);
Expand Down
8 changes: 5 additions & 3 deletions objc2-foundation/src/comparison_result.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@ use core::cmp::Ordering;

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

use crate::ffi;

#[repr(isize)] // NSInteger
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
pub enum NSComparisonResult {
Ascending = -1,
Same = 0,
Descending = 1,
Ascending = ffi::NSComparisonResult_NSOrderedAscending,
Same = ffi::NSComparisonResult_NSOrderedSame,
Descending = ffi::NSComparisonResult_NSOrderedDescending,
}

impl Default for NSComparisonResult {
Expand Down

0 comments on commit 1d4b7fd

Please sign in to comment.