Skip to content

Commit 0826a96

Browse files
committed
Use objc2
1 parent f4c24f2 commit 0826a96

File tree

19 files changed

+47
-48
lines changed

19 files changed

+47
-48
lines changed

cocoa-foundation/Cargo.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,11 @@ license = "MIT / Apache-2.0"
1212
default-target = "x86_64-apple-darwin"
1313

1414
[dependencies]
15-
block = "0.1"
15+
block = { version = "=0.2.0-alpha.4", package = "block2" }
1616
bitflags = "1.0"
1717
libc = "0.2"
1818
core-foundation = { path = "../core-foundation", version = "0.9" }
1919
core-graphics-types = { path = "../core-graphics-types", version = "0.1" }
2020
foreign-types = "0.3"
21-
# Current `master` of objc
22-
objc = { version = "=0.3.0-alpha.0", package = "objc2" }
23-
objc-encode = "1.1.0"
21+
objc2 = { version = "=0.3.0-beta.0" }
22+
objc-encode = { version = "=2.0.0-pre.0", package = "objc2-encode" }

cocoa-foundation/src/base.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@
77
// option. This file may not be copied, modified, or distributed
88
// except according to those terms.
99

10-
use objc::runtime;
10+
use objc2::runtime;
1111

12-
pub use objc::runtime::{BOOL, NO, YES};
12+
pub use objc2::runtime::{BOOL, NO, YES};
1313

1414
pub type Class = *mut runtime::Class;
1515
#[allow(non_camel_case_types)]

cocoa-foundation/src/foundation.rs

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ use std::os::raw::c_void;
1414
use base::{id, BOOL, NO, SEL, nil};
1515
use block::Block;
1616
use libc;
17-
use objc_encode::{Encode, Encoding};
17+
use objc_encode::{Encode, Encoding, RefEncode};
1818

1919

2020
#[cfg(target_pointer_width = "32")]
@@ -692,9 +692,8 @@ unsafe impl Encode for NSFastEnumerationState {
692692
);
693693
}
694694

695-
unsafe impl Encode for &'_ NSFastEnumerationState {
696-
const ENCODING: Encoding<'static> =
697-
Encoding::Pointer(&NSFastEnumerationState::ENCODING);
695+
unsafe impl RefEncode for NSFastEnumerationState {
696+
const ENCODING_REF: Encoding<'static> = Encoding::Pointer(&Self::ENCODING);
698697
}
699698

700699
const NS_FAST_ENUM_BUF_SIZE: usize = 16;

cocoa-foundation/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ extern crate foreign_types;
1818
extern crate libc;
1919
pub extern crate objc_encode;
2020
#[macro_use]
21-
extern crate objc;
21+
extern crate objc2;
2222

2323
pub use objc_encode as __objc_encode;
2424

cocoa-foundation/tests/foundation.rs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#[macro_use]
2-
extern crate objc;
2+
extern crate objc2;
33
extern crate block;
44
extern crate cocoa_foundation;
55

@@ -160,16 +160,18 @@ mod foundation {
160160
}
161161

162162
// First test cocoa sorting...
163-
let mut comparator = ConcreteBlock::new(|s0: id, s1: id| {
163+
let comparator = ConcreteBlock::new(|s0: id, s1: id| {
164164
match compare_function(&s0, &s1) {
165165
Ordering::Less => NSComparisonResult::NSOrderedAscending,
166166
Ordering::Equal => NSComparisonResult::NSOrderedSame,
167167
Ordering::Greater => NSComparisonResult::NSOrderedDescending,
168168
}
169169
});
170+
let comparator_ptr: *const _ = &*comparator;
171+
let comparator_ptr = comparator_ptr as *mut _;
170172

171173
let associated_iter = keys.iter().zip(objects.iter());
172-
for (k_id, (k, v)) in dict.keysSortedByValueUsingComparator_(&mut *comparator)
174+
for (k_id, (k, v)) in dict.keysSortedByValueUsingComparator_(comparator_ptr)
173175
.iter()
174176
.zip(associated_iter) {
175177
assert!(k_id.isEqualToString(k));

cocoa/Cargo.toml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,12 @@ license = "MIT / Apache-2.0"
1212
default-target = "x86_64-apple-darwin"
1313

1414
[dependencies]
15-
block = "0.1"
15+
block = { version = "=0.2.0-alpha.4", package = "block2" }
1616
bitflags = "1.0"
1717
libc = "0.2"
1818
cocoa-foundation = { path = "../cocoa-foundation", version = "0.1" }
1919
core-foundation = { path = "../core-foundation", version = "0.9" }
2020
core-graphics = { path = "../core-graphics", version = "0.22" }
2121
foreign-types = "0.3"
22-
# Current `master` of objc
23-
objc = { version = "=0.3.0-alpha.0", package = "objc2" }
24-
objc-encode = "1.1.0"
22+
objc2 = { version = "=0.3.0-beta.0" }
23+
objc-encode = { version = "=2.0.0-pre.0", package = "objc2-encode" }

cocoa/examples/fullscreen.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ extern crate cocoa;
22
extern crate core_graphics;
33

44
#[macro_use]
5-
extern crate objc;
5+
extern crate objc2;
66

77
use cocoa::base::{selector, nil, NO, id};
88
use cocoa::foundation::{NSRect, NSPoint, NSSize, NSAutoreleasePool, NSProcessInfo,
@@ -14,8 +14,8 @@ use cocoa::appkit::{NSApp, NSApplication, NSApplicationActivationPolicyRegular,
1414

1515
use core_graphics::display::CGDisplay;
1616

17-
use objc::runtime::{Object, Sel};
18-
use objc::declare::ClassDecl;
17+
use objc2::runtime::{Object, Sel};
18+
use objc2::declare::ClassDecl;
1919

2020
fn main() {
2121
unsafe {

cocoa/src/appkit.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3214,7 +3214,7 @@ pub trait NSButton: Sized {
32143214
}
32153215
unsafe fn initWithFrame_(self, frameRect: NSRect) -> id;
32163216
unsafe fn setTarget_(self, target: id /* Instance */);
3217-
unsafe fn setAction_(self, selector: objc::runtime::Sel /* (Instance *) */);
3217+
unsafe fn setAction_(self, selector: objc2::runtime::Sel /* (Instance *) */);
32183218
}
32193219

32203220
impl NSButton for id {
@@ -3234,7 +3234,7 @@ impl NSButton for id {
32343234
msg_send![self, setTarget:target]
32353235
}
32363236

3237-
unsafe fn setAction_(self, selector: objc::runtime::Sel /* (Instance method *) */) {
3237+
unsafe fn setAction_(self, selector: objc2::runtime::Sel /* (Instance method *) */) {
32383238
msg_send![self, setAction:selector]
32393239
}
32403240
}

cocoa/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ extern crate foreign_types;
2323
extern crate libc;
2424
extern crate objc_encode;
2525
#[macro_use]
26-
extern crate objc;
26+
extern crate objc2;
2727

2828
#[cfg(target_os = "macos")]
2929
pub mod appkit;

cocoa/src/macros.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@
1313
/// # Example with NSWindowDelegate
1414
/// ``` no_run
1515
/// #[macro_use] extern crate cocoa;
16-
/// #[macro_use] extern crate objc;
16+
/// #[macro_use] extern crate objc2;
1717
///
1818
/// use cocoa::appkit::NSWindow;
1919
/// use cocoa::base::{id, nil};
2020
///
21-
/// use objc::runtime::{Object, Sel};
21+
/// use objc2::runtime::{Object, Sel};
2222
///
2323
/// # fn main() {
2424
/// unsafe {
@@ -57,7 +57,7 @@ macro_rules! delegate {
5757
$( ($($sel:ident :)+) => $func:expr),*
5858
}
5959
) => ({
60-
let mut decl = objc::declare::ClassDecl::new($name, class!(NSObject)).unwrap();
60+
let mut decl = objc2::declare::ClassDecl::new($name, class!(NSObject)).unwrap();
6161

6262
$(
6363
decl.add_ivar::<$var_type>(stringify!($var));

cocoa/src/quartzcore.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1840,9 +1840,9 @@ unsafe impl ::objc_encode::Encode for CVTimeStamp {
18401840
);
18411841
}
18421842

1843-
unsafe impl ::objc_encode::Encode for &'_ CVTimeStamp {
1844-
const ENCODING: ::objc_encode::Encoding<'static> =
1845-
::objc_encode::Encoding::Pointer(&<CVTimeStamp as ::objc_encode::Encode>::ENCODING);
1843+
unsafe impl ::objc_encode::RefEncode for CVTimeStamp {
1844+
const ENCODING_REF: ::objc_encode::Encoding<'static> =
1845+
::objc_encode::Encoding::Pointer(&<Self as ::objc_encode::Encode>::ENCODING);
18461846
}
18471847

18481848
pub type CVTimeStampFlags = u64;

core-foundation-sys/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ authors = ["The Servo Project Developers"]
88
license = "MIT / Apache-2.0"
99

1010
[dependencies]
11-
objc-encode = "1.1.0"
11+
objc-encode = { version = "=2.0.0-pre.0", package = "objc2-encode" }
1212

1313
[features]
1414
mac_os_10_7_support = [] # backwards compatibility

core-foundation-sys/src/array.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,8 @@ pub struct __CFArray(c_void);
3535
pub type CFArrayRef = *const __CFArray;
3636
pub type CFMutableArrayRef = *mut __CFArray;
3737

38-
unsafe impl ::objc_encode::Encode for &'_ __CFArray {
39-
const ENCODING: ::objc_encode::Encoding<'static> = ::objc_encode::Encoding::Object;
38+
unsafe impl ::objc_encode::RefEncode for __CFArray {
39+
const ENCODING_REF: ::objc_encode::Encoding<'static> = ::objc_encode::Encoding::Object;
4040
}
4141

4242
extern {

core-foundation-sys/src/attributed_string.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ pub struct __CFAttributedString(c_void);
1818
pub type CFAttributedStringRef = *const __CFAttributedString;
1919
pub type CFMutableAttributedStringRef = *const __CFAttributedString;
2020

21-
unsafe impl ::objc_encode::Encode for &'_ __CFAttributedString {
22-
const ENCODING: ::objc_encode::Encoding<'static> = ::objc_encode::Encoding::Object;
21+
unsafe impl ::objc_encode::RefEncode for __CFAttributedString {
22+
const ENCODING_REF: ::objc_encode::Encoding<'static> = ::objc_encode::Encoding::Object;
2323
}
2424

2525
extern {

core-foundation-sys/src/dictionary.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,8 @@ pub struct __CFDictionary(c_void);
4747
pub type CFDictionaryRef = *const __CFDictionary;
4848
pub type CFMutableDictionaryRef = *mut __CFDictionary;
4949

50-
unsafe impl ::objc_encode::Encode for &'_ __CFDictionary {
51-
const ENCODING: ::objc_encode::Encoding<'static> = ::objc_encode::Encoding::Object;
50+
unsafe impl ::objc_encode::RefEncode for __CFDictionary {
51+
const ENCODING_REF: ::objc_encode::Encoding<'static> = ::objc_encode::Encoding::Object;
5252
}
5353

5454
extern {

core-foundation-sys/src/string.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -192,8 +192,8 @@ pub struct __CFString(c_void);
192192

193193
pub type CFStringRef = *const __CFString;
194194

195-
unsafe impl ::objc_encode::Encode for &'_ __CFString {
196-
const ENCODING: ::objc_encode::Encoding<'static> = ::objc_encode::Encoding::Object;
195+
unsafe impl ::objc_encode::RefEncode for __CFString {
196+
const ENCODING_REF: ::objc_encode::Encoding<'static> = ::objc_encode::Encoding::Object;
197197
}
198198

199199
extern {

core-graphics-types/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ bitflags = "1.0"
1212
core-foundation = { path = "../core-foundation", version = "0.9" }
1313
foreign-types = "0.3.0"
1414
libc = "0.2"
15-
objc-encode = "1.1.0"
15+
objc-encode = { version = "=2.0.0-pre.0", package = "objc2-encode" }
1616

1717
[package.metadata.docs.rs]
1818
default-target = "x86_64-apple-darwin"

core-graphics/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ core-foundation = { path = "../core-foundation", version = "0.9" }
1818
core-graphics-types = { path = "../core-graphics-types", version = "0.1" }
1919
foreign-types = "0.3.0"
2020
libc = "0.2"
21-
objc-encode = "1.1.0"
21+
objc-encode = { version = "=2.0.0-pre.0", package = "objc2-encode" }
2222

2323
[package.metadata.docs.rs]
2424
default-target = "x86_64-apple-darwin"

core-graphics/src/sys.rs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
use std::os::raw::c_void;
22

3-
use objc_encode::{Encode, Encoding};
3+
use objc_encode::{Encoding, RefEncode};
44

55
pub enum CGImage {}
66
pub type CGImageRef = *mut CGImage;
77

88
#[repr(C)]
99
pub struct __CGColor(c_void);
1010

11-
unsafe impl Encode for &'_ __CGColor {
12-
const ENCODING: Encoding<'static> = Encoding::Unknown;
11+
unsafe impl RefEncode for __CGColor {
12+
const ENCODING_REF: Encoding<'static> = Encoding::Unknown;
1313
}
1414

1515
pub type CGColorRef = *const __CGColor;
@@ -20,8 +20,8 @@ pub type CGColorSpaceRef = *mut CGColorSpace;
2020
pub enum CGPath {}
2121
pub type CGPathRef = *mut CGPath;
2222

23-
unsafe impl Encode for &'_ CGPath {
24-
const ENCODING: Encoding<'static> = Encoding::Unknown;
23+
unsafe impl RefEncode for CGPath {
24+
const ENCODING_REF: Encoding<'static> = Encoding::Unknown;
2525
}
2626

2727
pub enum CGDataProvider {}
@@ -33,8 +33,8 @@ pub type CGFontRef = *mut CGFont;
3333
pub enum CGContext {}
3434
pub type CGContextRef = *mut CGContext;
3535

36-
unsafe impl Encode for &'_ CGContext {
37-
const ENCODING: Encoding<'static> = Encoding::Unknown;
36+
unsafe impl RefEncode for CGContext {
37+
const ENCODING_REF: Encoding<'static> = Encoding::Unknown;
3838
}
3939

4040
pub enum CGGradient {}

0 commit comments

Comments
 (0)