Skip to content

Commit

Permalink
Rename objc -> objc2
Browse files Browse the repository at this point in the history
  • Loading branch information
madsmtm committed Sep 8, 2021
1 parent 7e2868b commit daa0634
Show file tree
Hide file tree
Showing 32 changed files with 97 additions and 97 deletions.
2 changes: 1 addition & 1 deletion .travis-disabled.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
2 changes: 1 addition & 1 deletion 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
4 changes: 2 additions & 2 deletions 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 @@ -13,7 +13,7 @@ categories = [
]
readme = "README.md"
repository = "https://github.com/madsmtm/objc2"
documentation = "https://docs.rs/objc/"
documentation = "https://docs.rs/objc2/"
license = "MIT"

exclude = [
Expand Down
20 changes: 10 additions & 10 deletions objc2/README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
# `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/)
[![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
6 changes: 3 additions & 3 deletions objc2/examples/introspection.rs
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
6 changes: 3 additions & 3 deletions 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
6 changes: 3 additions & 3 deletions 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 Down
8 changes: 4 additions & 4 deletions 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 Down Expand Up @@ -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
6 changes: 3 additions & 3 deletions 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
22 changes: 11 additions & 11 deletions 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 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
8 changes: 4 additions & 4 deletions objc2/tests-ios/prelude.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#[macro_use]
extern crate objc;
extern crate objc2;

use objc::rc::*;
use objc::runtime::*;
pub use objc::*;
use objc2::rc::*;
use objc2::runtime::*;
pub use objc2::*;

#[path = "../src/test_utils.rs"]
mod test_utils;
4 changes: 2 additions & 2 deletions objc2/tests/use_macros.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#![cfg(target_vendor = "apple")]

use objc::runtime::Object;
use objc::{class, msg_send, sel};
use objc2::runtime::Object;
use objc2::{class, msg_send, sel};

#[test]
fn use_class_and_msg_send() {
Expand Down
2 changes: 1 addition & 1 deletion objc2_block/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ use std::os::raw::{c_int, c_ulong};

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

// TODO: Replace with `objc::Class`
// TODO: Replace with `objc2::Class`
#[repr(C)]
struct ClassInternal {
_priv: [u8; 0],
Expand Down
4 changes: 2 additions & 2 deletions objc2_encode/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,8 @@ Additionally it provides traits for annotating types that has a corresponding
Objective-C encoding, respectively `Encode` for structs and `RefEncode` for
references (and `EncodeArguments` for function arguments).

These types are exported under the `objc` crate as well, so usually you would
just use that crate.
These types are exported under the `objc2` crate as well, so usually you would
just use that.

# Examples

Expand Down
2 changes: 1 addition & 1 deletion objc2_encode/src/encode.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use crate::Encoding;
/// in Objective-C with the type in question.
///
/// You should also beware of having [`Drop`] types implement this, since when
/// passed to Objective-C via. `objc::msg_send!` their destructor will not be
/// passed to Objective-C via. `objc2::msg_send!` their destructor will not be
/// called!
///
/// # Examples
Expand Down
2 changes: 1 addition & 1 deletion objc2_foundation/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,5 +23,5 @@ block = ["objc2_block"]

[dependencies]
objc2_block = { path = "../objc2_block", optional = true }
objc = { path = "../objc2", version = "0.2.7" }
objc2 = { path = "../objc2" }
objc2_id = { path = "../objc2_id" }
8 changes: 4 additions & 4 deletions objc2_foundation/examples/custom_class.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use std::sync::Once;

use objc::declare::ClassDecl;
use objc::runtime::{Class, Object, Sel};
use objc::{msg_send, sel};
use objc::{Encoding, Message, RefEncode};
use objc2::declare::ClassDecl;
use objc2::runtime::{Class, Object, Sel};
use objc2::{msg_send, sel};
use objc2::{Encoding, Message, RefEncode};
use objc2_foundation::{INSObject, NSObject};

/// In the future this should be an `extern type`, if that gets stabilized,
Expand Down
6 changes: 3 additions & 3 deletions objc2_foundation/src/array.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@ use core::ffi::c_void;
use core::marker::PhantomData;
use core::ops::{Index, Range};

use objc::runtime::{Class, Object};
use objc::{class, msg_send};
use objc::{Encode, Encoding};
use objc2::runtime::{Class, Object};
use objc2::{class, msg_send};
use objc2::{Encode, Encoding};
use objc2_id::{Id, Owned, Ownership, ShareId, Shared};

use super::{INSCopying, INSFastEnumeration, INSMutableCopying, INSObject, NSEnumerator};
Expand Down
2 changes: 1 addition & 1 deletion objc2_foundation/src/data.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use core::ops::Range;
use core::slice;

use super::{INSCopying, INSMutableCopying, INSObject, NSRange};
use objc::msg_send;
use objc2::msg_send;
#[cfg(feature = "block")]
use objc2_block::{Block, ConcreteBlock};
use objc2_id::Id;
Expand Down
4 changes: 2 additions & 2 deletions objc2_foundation/src/dictionary.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use core::marker::PhantomData;
use core::ops::Index;
use core::ptr;

use objc::runtime::Class;
use objc::{class, msg_send};
use objc2::runtime::Class;
use objc2::{class, msg_send};
use objc2_id::{Id, Owned, Ownership, ShareId};

use super::{INSCopying, INSFastEnumeration, INSObject, NSArray, NSEnumerator, NSSharedArray};
Expand Down
4 changes: 2 additions & 2 deletions objc2_foundation/src/enumerator.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ use core::ptr;
use core::slice;
use std::os::raw::c_ulong;

use objc::runtime::Object;
use objc::{msg_send, Encode, Encoding, RefEncode};
use objc2::runtime::Object;
use objc2::{msg_send, Encode, Encoding, RefEncode};
use objc2_id::Id;

use super::INSObject;
Expand Down
2 changes: 1 addition & 1 deletion objc2_foundation/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub use self::value::{INSValue, NSValue};
extern "C" {}

#[cfg(not(target_vendor = "apple"))]
use objc::runtime::Class;
use objc2::runtime::Class;

#[cfg(not(target_vendor = "apple"))]
#[link(name = "gnustep-base", kind = "dylib")]
Expand Down
16 changes: 8 additions & 8 deletions objc2_foundation/src/macros.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,15 @@ macro_rules! object_struct {
_private: [u8; 0],
}

unsafe impl ::objc::Message for $name {}
unsafe impl ::objc2::Message for $name {}

unsafe impl ::objc::RefEncode for $name {
const ENCODING_REF: ::objc::Encoding<'static> = ::objc::Encoding::Object;
unsafe impl ::objc2::RefEncode for $name {
const ENCODING_REF: ::objc2::Encoding<'static> = ::objc2::Encoding::Object;
}

impl $crate::INSObject for $name {
fn class() -> &'static ::objc::runtime::Class {
::objc::class!($name)
fn class() -> &'static ::objc2::runtime::Class {
::objc2::class!($name)
}
}

Expand Down Expand Up @@ -55,10 +55,10 @@ macro_rules! object_impl {
object_impl!($name, $($t),+);
);
($name:ident, $($t:ident),*) => (
unsafe impl<$($t),*> ::objc::Message for $name<$($t),*> { }
unsafe impl<$($t),*> ::objc2::Message for $name<$($t),*> { }

unsafe impl<$($t),*> ::objc::RefEncode for $name<$($t),*> {
const ENCODING_REF: ::objc::Encoding<'static> = ::objc::Encoding::Object;
unsafe impl<$($t),*> ::objc2::RefEncode for $name<$($t),*> {
const ENCODING_REF: ::objc2::Encoding<'static> = ::objc2::Encoding::Object;
}
);
}
Loading

0 comments on commit daa0634

Please sign in to comment.