Skip to content

Commit

Permalink
Merge pull request #34 from madsmtm/rename-project
Browse files Browse the repository at this point in the history
Rename project to `objc2`
  • Loading branch information
madsmtm authored Sep 8, 2021
2 parents 8d49116 + daa0634 commit 0c8f7e0
Show file tree
Hide file tree
Showing 98 changed files with 264 additions and 261 deletions.
6 changes: 3 additions & 3 deletions .travis-disabled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ jobs:
script:
- cargo test --workspace --verbose
- # TODO: cargo test --workspace --verbose --all-features
- # objc_exception doesn't work on 32bit?
cargo test --workspace --exclude objc_exception --verbose -Z build-std --target i686-apple-darwin
- # objc2_exception doesn't work on 32bit?
cargo test --workspace --exclude objc2_exception --verbose -Z build-std --target i686-apple-darwin
- # TODO: cargo test --workspace --verbose --all-features -Z build-std --target i686-apple-darwin

- name: MacOS 11.3
Expand All @@ -42,4 +42,4 @@ jobs:
# Remove workspace since `rust-test-ios` is not made for that
- rm Cargo.toml
# TODO: env: FEATURES="exception"
script: cd objc && ../rust-test-ios
script: cd objc2 && ../rust-test-ios
20 changes: 10 additions & 10 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
[workspace]
members = [
"objc",
"objc_block",
"objc_encode",
"objc_exception",
"objc_foundation",
"objc_foundation_derive",
"objc_id",
"objc_sys",
"objc_test_utils",
"objc2",
"objc2_block",
"objc2_encode",
"objc2_exception",
"objc2_foundation",
"objc2_foundation_derive",
"objc2_id",
"objc2_sys",
"objc2_test_utils",
]
exclude = ["objc/tests-ios"]
exclude = ["objc2/tests-ios"]
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# Objective-C in Rust

[![License](https://badgen.net/badge/license/MIT/blue)](../LICENSE.txt)
[![CI Status](https://github.com/madsmtm/objc/workflows/CI/badge.svg)](https://github.com/madsmtm/objc/actions)
[![CI Status](https://github.com/madsmtm/objc2/workflows/CI/badge.svg)](https://github.com/madsmtm/objc2/actions)
9 changes: 0 additions & 9 deletions objc/tests-ios/prelude.rs

This file was deleted.

2 changes: 1 addition & 1 deletion objc/CHANGELOG.md → objc2/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@

### Fixed

* Fixed the implementation of `objc::runtime` structs so there can't be unsound
* Fixed the implementation of `objc2::runtime` structs so there can't be unsound
references to uninhabited types.

## 0.2.2
Expand Down
14 changes: 7 additions & 7 deletions objc/Cargo.toml → objc2/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "objc"
name = "objc2"
version = "0.2.7" # Remember to update html_root_url in lib.rs
authors = ["Steven Sheldon", "Mads Marquart <[email protected]>"]
edition = "2018"
Expand All @@ -12,8 +12,8 @@ categories = [
"os::macos-apis",
]
readme = "README.md"
repository = "https://github.com/madsmtm/objc"
documentation = "https://docs.rs/objc/"
repository = "https://github.com/madsmtm/objc2"
documentation = "https://docs.rs/objc2/"
license = "MIT"

exclude = [
Expand All @@ -22,12 +22,12 @@ exclude = [
]

[features]
exception = ["objc_exception"]
exception = ["objc2_exception"]
verify_message = []
unstable_autoreleasesafe = []

[dependencies]
malloc_buf = "1.0"
objc_sys = { path = "../objc_sys" }
objc-encode = { path = "../objc_encode", version = "1.0" }
objc_exception = { path = "../objc_exception", version = "0.1", optional = true }
objc2_sys = { path = "../objc2_sys" }
objc2_encode = { path = "../objc2_encode" }
objc2_exception = { path = "../objc2_exception", optional = true }
22 changes: 11 additions & 11 deletions objc/README.md → objc2/README.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# `objc`
# `objc2`

[![Latest version](https://badgen.net/crates/v/objc)](https://crates.io/crates/objc)
[![Latest version](https://badgen.net/crates/v/objc2)](https://crates.io/crates/objc2)
[![License](https://badgen.net/badge/license/MIT/blue)](../LICENSE.txt)
[![Documentation](https://docs.rs/objc/badge.svg)](https://docs.rs/objc/)
[![CI Status](https://github.com/madsmtm/objc/workflows/CI/badge.svg)](https://github.com/madsmtm/objc/actions)
[![Documentation](https://docs.rs/objc2/badge.svg)](https://docs.rs/objc2/)
[![CI Status](https://github.com/madsmtm/objc2/workflows/CI/badge.svg)](https://github.com/madsmtm/objc2/actions)

Objective-C Runtime bindings and wrapper for Rust.

Expand All @@ -12,8 +12,8 @@ Objective-C Runtime bindings and wrapper for Rust.
Objective-C objects can be messaged using the `msg_send!` macro:

```rust , no_run
use objc::{class, msg_send};
use objc::runtime::{BOOL, Object};
use objc2::{class, msg_send};
use objc2::runtime::{BOOL, Object};

let cls = class!(NSObject);
unsafe {
Expand All @@ -34,8 +34,8 @@ A `WeakPtr` will not retain the object, but can be upgraded to a `StrongPtr`
and safely fails if the object has been deallocated.

```rust , no_run
use objc::{class, msg_send};
use objc::rc::{autoreleasepool, StrongPtr};
use objc2::{class, msg_send};
use objc2::rc::{autoreleasepool, StrongPtr};

// StrongPtr will release the object when dropped
let obj = unsafe {
Expand Down Expand Up @@ -65,9 +65,9 @@ The following example demonstrates declaring a class named `MyNumber` that has
one ivar, a `u32` named `_number` and a `number` method that returns it:

```rust , no_run
use objc::{class, sel};
use objc::declare::ClassDecl;
use objc::runtime::{Object, Sel};
use objc2::{class, sel};
use objc2::declare::ClassDecl;
use objc2::runtime::{Object, Sel};

let superclass = class!(NSObject);
let mut decl = ClassDecl::new("MyNumber", superclass).unwrap();
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use objc::rc::StrongPtr;
use objc::runtime::{Class, Object};
use objc::{class, msg_send, sel, Encode};
use objc2::rc::StrongPtr;
use objc2::runtime::{Class, Object};
use objc2::{class, msg_send, sel, Encode};

fn main() {
// Get a class
Expand Down
File renamed without changes.
6 changes: 3 additions & 3 deletions objc/src/declare.rs → objc2/src/declare.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ The following example demonstrates declaring a class named `MyNumber` that has
one ivar, a `u32` named `_number` and a `number` method that returns it:
``` no_run
# use objc::{class, sel};
# use objc::declare::ClassDecl;
# use objc::runtime::{Class, Object, Sel};
# use objc2::{class, sel};
# use objc2::declare::ClassDecl;
# use objc2::runtime::{Class, Object, Sel};
let superclass = class!(NSObject);
let mut decl = ClassDecl::new("MyNumber", superclass).unwrap();
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions objc/src/exception.rs → objc2/src/exception.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
use crate::rc::StrongPtr;
use crate::runtime::Object;

// Comment copied from `objc_exception`
// Comment copied from `objc2_exception`

/// Tries to execute the given closure and catches an Objective-C exception
/// if one is thrown.
Expand All @@ -19,5 +19,5 @@ use crate::runtime::Object;
///
/// [RFC-2945]: https://rust-lang.github.io/rfcs/2945-c-unwind-abi.html
pub unsafe fn catch_exception<R>(closure: impl FnOnce() -> R) -> Result<R, StrongPtr> {
objc_exception::r#try(closure).map_err(|exception| StrongPtr::new(exception as *mut Object))
objc2_exception::r#try(closure).map_err(|exception| StrongPtr::new(exception as *mut Object))
}
8 changes: 4 additions & 4 deletions objc/src/lib.rs → objc2/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ Objective-C Runtime bindings and wrapper for Rust.
Objective-C objects can be messaged using the [`msg_send!`](macro.msg_send!.html) macro:
``` no_run
# use objc::{class, msg_send};
# use objc::runtime::{BOOL, Class, Object};
# use objc2::{class, msg_send};
# use objc2::runtime::{BOOL, Class, Object};
# unsafe {
let cls = class!(NSObject);
let obj: *mut Object = msg_send![cls, new];
Expand Down Expand Up @@ -66,7 +66,7 @@ The bindings can be used on Linux or *BSD utilizing the
#![warn(missing_docs)]
#![allow(clippy::missing_safety_doc)]
// Update in Cargo.toml as well.
#![doc(html_root_url = "https://docs.rs/objc/0.2.7")]
#![doc(html_root_url = "https://docs.rs/objc2/0.2.7")]

extern crate alloc;
extern crate std;
Expand All @@ -79,7 +79,7 @@ extern "C" {}
#[doc = include_str!("../../README.md")]
extern "C" {}

pub use objc_encode::{Encode, EncodeArguments, Encoding, RefEncode};
pub use objc2_encode::{Encode, EncodeArguments, Encoding, RefEncode};

pub use crate::message::{Message, MessageArguments, MessageError};

Expand Down
10 changes: 5 additions & 5 deletions objc/src/macros.rs → objc2/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ To check for a class that may not exist, use [`Class::get`].
# Examples
``` no_run
# use objc::class;
# use objc2::class;
let cls = class!(NSObject);
```
*/
Expand Down Expand Up @@ -41,7 +41,7 @@ Returns a [`Sel`].
# Examples
```
# use objc::sel;
# use objc2::sel;
let sel = sel!(description);
let sel = sel!(setObject:forKey:);
```
Expand All @@ -66,7 +66,7 @@ macro_rules! sel {
Sends a message to an object.
The first argument can be any type that dereferences to a type that implements
[`Message`], like a reference, a pointer, or an `objc_id::Id` to an object.
[`Message`], like a reference, a pointer, or an `objc2_id::Id` to an object.
The syntax is similar to the message syntax in Objective-C.
Expand All @@ -85,8 +85,8 @@ method's argument's encoding does not match the encoding of the given arguments.
# Examples
``` no_run
# use objc::msg_send;
# use objc::runtime::Object;
# use objc2::msg_send;
# use objc2::runtime::Object;
# unsafe {
let obj: *mut Object;
# let obj: *mut Object = 0 as *mut Object;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use core::mem;
use objc_sys::{objc_msgSend, objc_msgSendSuper, objc_msgSendSuper_stret, objc_msgSend_stret};
use objc2_sys::{objc_msgSend, objc_msgSendSuper, objc_msgSendSuper_stret, objc_msgSend_stret};

use super::MsgSendFn;
use crate::runtime::Imp;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use objc_sys::{objc_msgSend, objc_msgSendSuper};
use objc2_sys::{objc_msgSend, objc_msgSendSuper};

use super::MsgSendFn;
use crate::runtime::Imp;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use objc_sys::objc_super;
use objc2_sys::objc_super;

use super::{Encode, Message, MessageArguments, MessageError};
use crate::runtime::{Class, Imp, Object, Sel};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use core::mem;
use objc_sys::{
use objc2_sys::{
objc_msgSend, objc_msgSendSuper, objc_msgSendSuper_stret, objc_msgSend_fpret,
objc_msgSend_stret,
};
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use core::mem;
use objc_sys::{objc_msgSend, objc_msgSendSuper, objc_msgSendSuper_stret, objc_msgSend_stret};
use objc2_sys::{objc_msgSend, objc_msgSendSuper, objc_msgSendSuper_stret, objc_msgSend_stret};

use super::MsgSendFn;
use crate::runtime::Imp;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use core::mem;
use objc_sys::{objc_msg_lookup, objc_msg_lookup_super, objc_super};
use objc2_sys::{objc_msg_lookup, objc_msg_lookup_super, objc_super};

use super::{Encode, Message, MessageArguments, MessageError};
use crate::runtime::{Class, Object, Sel};
Expand Down
6 changes: 3 additions & 3 deletions objc/src/message/mod.rs → objc2/src/message/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,9 +85,9 @@ pub unsafe trait Message: RefEncode {
# Example
``` no_run
# use objc::{class, msg_send, sel};
# use objc::runtime::{BOOL, Class, Object};
# use objc::Message;
# use objc2::{class, msg_send, sel};
# use objc2::runtime::{BOOL, Class, Object};
# use objc2::Message;
let obj: &Object;
# obj = unsafe { msg_send![class!(NSObject), new] };
let sel = sel!(isKindOfClass:);
Expand Down
File renamed without changes.
22 changes: 11 additions & 11 deletions objc/src/rc/autorelease.rs → objc2/src/rc/autorelease.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,12 @@ pub struct AutoreleasePool {
}

/// ```rust,compile_fail
/// use objc::rc::AutoreleasePool;
/// use objc2::rc::AutoreleasePool;
/// fn needs_sync<T: Send>() {}
/// needs_sync::<AutoreleasePool>();
/// ```
/// ```rust,compile_fail
/// use objc::rc::AutoreleasePool;
/// use objc2::rc::AutoreleasePool;
/// fn needs_send<T: Send>() {}
/// needs_send::<AutoreleasePool>();
/// ```
Expand Down Expand Up @@ -224,9 +224,9 @@ impl !AutoreleaseSafe for AutoreleasePool {}
/// Basic usage:
///
/// ```rust
/// use objc::{class, msg_send};
/// use objc::rc::{autoreleasepool, AutoreleasePool};
/// use objc::runtime::Object;
/// use objc2::{class, msg_send};
/// use objc2::rc::{autoreleasepool, AutoreleasePool};
/// use objc2::runtime::Object;
///
/// fn needs_lifetime_from_pool<'p>(pool: &'p AutoreleasePool) -> &'p mut Object {
/// let obj: *mut Object = unsafe { msg_send![class!(NSObject), new] };
Expand All @@ -247,9 +247,9 @@ impl !AutoreleaseSafe for AutoreleasePool {}
/// safely take it out of the pool:
///
/// ```rust,compile_fail
/// # use objc::{class, msg_send};
/// # use objc::rc::{autoreleasepool, AutoreleasePool};
/// # use objc::runtime::Object;
/// # use objc2::{class, msg_send};
/// # use objc2::rc::{autoreleasepool, AutoreleasePool};
/// # use objc2::runtime::Object;
/// #
/// # fn needs_lifetime_from_pool<'p>(pool: &'p AutoreleasePool) -> &'p mut Object {
/// # let obj: *mut Object = unsafe { msg_send![class!(NSObject), new] };
Expand All @@ -272,9 +272,9 @@ impl !AutoreleaseSafe for AutoreleasePool {}
not(feature = "unstable_autoreleasesafe"),
doc = "```rust,should_panic"
)]
/// # use objc::{class, msg_send};
/// # use objc::rc::{autoreleasepool, AutoreleasePool};
/// # use objc::runtime::Object;
/// # use objc2::{class, msg_send};
/// # use objc2::rc::{autoreleasepool, AutoreleasePool};
/// # use objc2::runtime::Object;
/// #
/// # fn needs_lifetime_from_pool<'p>(pool: &'p AutoreleasePool) -> &'p mut Object {
/// # let obj: *mut Object = unsafe { msg_send![class!(NSObject), new] };
Expand Down
4 changes: 2 additions & 2 deletions objc/src/rc/mod.rs → objc2/src/rc/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ For more information on Objective-C's reference counting, see Apple's documentat
# Example
``` no_run
# use objc::{class, msg_send};
# use objc::rc::{autoreleasepool, StrongPtr};
# use objc2::{class, msg_send};
# use objc2::rc::{autoreleasepool, StrongPtr};
// StrongPtr will release the object when dropped
let obj = unsafe {
StrongPtr::new(msg_send![class!(NSObject), new])
Expand Down
File renamed without changes.
File renamed without changes.
Loading

0 comments on commit 0c8f7e0

Please sign in to comment.