Skip to content

Commit

Permalink
Add debug and copy to objective-c derive
Browse files Browse the repository at this point in the history
  • Loading branch information
simlay committed Mar 8, 2022
1 parent 9a2d1bd commit bb7fd33
Show file tree
Hide file tree
Showing 19 changed files with 30 additions and 30 deletions.
2 changes: 1 addition & 1 deletion src/codegen/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4145,7 +4145,7 @@ impl CodeGenerator for ObjCInterface {
if !self.is_category() && !self.is_protocol() {
let struct_block = quote! {
#[repr(transparent)]
#[derive(Clone)]
#[derive(Debug, Copy, Clone)]
pub struct #class_name(pub id);
impl std::ops::Deref for #class_name {
type Target = objc::runtime::Object;
Expand Down
6 changes: 3 additions & 3 deletions tests/expectations/tests/libclang-4/objc_inheritance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use objc::{self, class, msg_send, sel, sel_impl};
#[allow(non_camel_case_types)]
pub type id = *mut objc::runtime::Object;
#[repr(transparent)]
#[derive(Clone)]
#[derive(Debug, Copy, Clone)]
pub struct Foo(pub id);
impl std::ops::Deref for Foo {
type Target = objc::runtime::Object;
Expand All @@ -27,7 +27,7 @@ impl Foo {
impl IFoo for Foo {}
pub trait IFoo: Sized + std::ops::Deref {}
#[repr(transparent)]
#[derive(Clone)]
#[derive(Debug, Copy, Clone)]
pub struct Bar(pub id);
impl std::ops::Deref for Bar {
type Target = objc::runtime::Object;
Expand Down Expand Up @@ -62,7 +62,7 @@ impl std::convert::TryFrom<Foo> for Bar {
impl IBar for Bar {}
pub trait IBar: Sized + std::ops::Deref {}
#[repr(transparent)]
#[derive(Clone)]
#[derive(Debug, Copy, Clone)]
pub struct Baz(pub id);
impl std::ops::Deref for Baz {
type Target = objc::runtime::Object;
Expand Down
4 changes: 2 additions & 2 deletions tests/expectations/tests/libclang-4/objc_template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use objc::{self, class, msg_send, sel, sel_impl};
#[allow(non_camel_case_types)]
pub type id = *mut objc::runtime::Object;
#[repr(transparent)]
#[derive(Clone)]
#[derive(Debug, Copy, Clone)]
pub struct Foo(pub id);
impl std::ops::Deref for Foo {
type Target = objc::runtime::Object;
Expand All @@ -34,7 +34,7 @@ pub trait IFoo<ObjectType: 'static>: Sized + std::ops::Deref {
}
}
#[repr(transparent)]
#[derive(Clone)]
#[derive(Debug, Copy, Clone)]
pub struct FooMultiGeneric(pub id);
impl std::ops::Deref for FooMultiGeneric {
type Target = objc::runtime::Object;
Expand Down
6 changes: 3 additions & 3 deletions tests/expectations/tests/libclang-5/objc_inheritance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use objc::{self, class, msg_send, sel, sel_impl};
#[allow(non_camel_case_types)]
pub type id = *mut objc::runtime::Object;
#[repr(transparent)]
#[derive(Clone)]
#[derive(Debug, Copy, Clone)]
pub struct Foo(pub id);
impl std::ops::Deref for Foo {
type Target = objc::runtime::Object;
Expand All @@ -27,7 +27,7 @@ impl Foo {
impl IFoo for Foo {}
pub trait IFoo: Sized + std::ops::Deref {}
#[repr(transparent)]
#[derive(Clone)]
#[derive(Debug, Copy, Clone)]
pub struct Bar(pub id);
impl std::ops::Deref for Bar {
type Target = objc::runtime::Object;
Expand Down Expand Up @@ -62,7 +62,7 @@ impl std::convert::TryFrom<Foo> for Bar {
impl IBar for Bar {}
pub trait IBar: Sized + std::ops::Deref {}
#[repr(transparent)]
#[derive(Clone)]
#[derive(Debug, Copy, Clone)]
pub struct Baz(pub id);
impl std::ops::Deref for Baz {
type Target = objc::runtime::Object;
Expand Down
4 changes: 2 additions & 2 deletions tests/expectations/tests/libclang-5/objc_template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use objc::{self, class, msg_send, sel, sel_impl};
#[allow(non_camel_case_types)]
pub type id = *mut objc::runtime::Object;
#[repr(transparent)]
#[derive(Clone)]
#[derive(Debug, Copy, Clone)]
pub struct Foo(pub id);
impl std::ops::Deref for Foo {
type Target = objc::runtime::Object;
Expand All @@ -34,7 +34,7 @@ pub trait IFoo<ObjectType: 'static>: Sized + std::ops::Deref {
}
}
#[repr(transparent)]
#[derive(Clone)]
#[derive(Debug, Copy, Clone)]
pub struct FooMultiGeneric(pub id);
impl std::ops::Deref for FooMultiGeneric {
type Target = objc::runtime::Object;
Expand Down
6 changes: 3 additions & 3 deletions tests/expectations/tests/libclang-9/objc_inheritance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use objc::{self, class, msg_send, sel, sel_impl};
#[allow(non_camel_case_types)]
pub type id = *mut objc::runtime::Object;
#[repr(transparent)]
#[derive(Clone)]
#[derive(Debug, Copy, Clone)]
pub struct Foo(pub id);
impl std::ops::Deref for Foo {
type Target = objc::runtime::Object;
Expand All @@ -27,7 +27,7 @@ impl Foo {
impl IFoo for Foo {}
pub trait IFoo: Sized + std::ops::Deref {}
#[repr(transparent)]
#[derive(Clone)]
#[derive(Debug, Copy, Clone)]
pub struct Bar(pub id);
impl std::ops::Deref for Bar {
type Target = objc::runtime::Object;
Expand Down Expand Up @@ -62,7 +62,7 @@ impl std::convert::TryFrom<Foo> for Bar {
impl IBar for Bar {}
pub trait IBar: Sized + std::ops::Deref {}
#[repr(transparent)]
#[derive(Clone)]
#[derive(Debug, Copy, Clone)]
pub struct Baz(pub id);
impl std::ops::Deref for Baz {
type Target = objc::runtime::Object;
Expand Down
4 changes: 2 additions & 2 deletions tests/expectations/tests/libclang-9/objc_template.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use objc::{self, class, msg_send, sel, sel_impl};
#[allow(non_camel_case_types)]
pub type id = *mut objc::runtime::Object;
#[repr(transparent)]
#[derive(Clone)]
#[derive(Debug, Copy, Clone)]
pub struct Foo(pub id);
impl std::ops::Deref for Foo {
type Target = objc::runtime::Object;
Expand All @@ -34,7 +34,7 @@ pub trait IFoo<ObjectType: 'static>: Sized + std::ops::Deref {
}
}
#[repr(transparent)]
#[derive(Clone)]
#[derive(Debug, Copy, Clone)]
pub struct FooMultiGeneric(pub id);
impl std::ops::Deref for FooMultiGeneric {
type Target = objc::runtime::Object;
Expand Down
2 changes: 1 addition & 1 deletion tests/expectations/tests/objc_allowlist.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub trait PSomeProtocol: Sized + std::ops::Deref {
}
}
#[repr(transparent)]
#[derive(Clone)]
#[derive(Debug, Copy, Clone)]
pub struct AllowlistMe(pub id);
impl std::ops::Deref for AllowlistMe {
type Target = objc::runtime::Object;
Expand Down
2 changes: 1 addition & 1 deletion tests/expectations/tests/objc_category.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use objc::{self, class, msg_send, sel, sel_impl};
#[allow(non_camel_case_types)]
pub type id = *mut objc::runtime::Object;
#[repr(transparent)]
#[derive(Clone)]
#[derive(Debug, Copy, Clone)]
pub struct Foo(pub id);
impl std::ops::Deref for Foo {
type Target = objc::runtime::Object;
Expand Down
2 changes: 1 addition & 1 deletion tests/expectations/tests/objc_class.rs
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ extern "C" {
pub static mut fooVar: Foo;
}
#[repr(transparent)]
#[derive(Clone)]
#[derive(Debug, Copy, Clone)]
pub struct Foo(pub id);
impl std::ops::Deref for Foo {
type Target = objc::runtime::Object;
Expand Down
2 changes: 1 addition & 1 deletion tests/expectations/tests/objc_class_method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use objc::{self, class, msg_send, sel, sel_impl};
#[allow(non_camel_case_types)]
pub type id = *mut objc::runtime::Object;
#[repr(transparent)]
#[derive(Clone)]
#[derive(Debug, Copy, Clone)]
pub struct Foo(pub id);
impl std::ops::Deref for Foo {
type Target = objc::runtime::Object;
Expand Down
2 changes: 1 addition & 1 deletion tests/expectations/tests/objc_interface.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use objc::{self, class, msg_send, sel, sel_impl};
#[allow(non_camel_case_types)]
pub type id = *mut objc::runtime::Object;
#[repr(transparent)]
#[derive(Clone)]
#[derive(Debug, Copy, Clone)]
pub struct Foo(pub id);
impl std::ops::Deref for Foo {
type Target = objc::runtime::Object;
Expand Down
2 changes: 1 addition & 1 deletion tests/expectations/tests/objc_interface_type.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use objc::{self, class, msg_send, sel, sel_impl};
#[allow(non_camel_case_types)]
pub type id = *mut objc::runtime::Object;
#[repr(transparent)]
#[derive(Clone)]
#[derive(Debug, Copy, Clone)]
pub struct Foo(pub id);
impl std::ops::Deref for Foo {
type Target = objc::runtime::Object;
Expand Down
2 changes: 1 addition & 1 deletion tests/expectations/tests/objc_method.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use objc::{self, class, msg_send, sel, sel_impl};
#[allow(non_camel_case_types)]
pub type id = *mut objc::runtime::Object;
#[repr(transparent)]
#[derive(Clone)]
#[derive(Debug, Copy, Clone)]
pub struct Foo(pub id);
impl std::ops::Deref for Foo {
type Target = objc::runtime::Object;
Expand Down
2 changes: 1 addition & 1 deletion tests/expectations/tests/objc_method_clash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use objc::{self, class, msg_send, sel, sel_impl};
#[allow(non_camel_case_types)]
pub type id = *mut objc::runtime::Object;
#[repr(transparent)]
#[derive(Clone)]
#[derive(Debug, Copy, Clone)]
pub struct Foo(pub id);
impl std::ops::Deref for Foo {
type Target = objc::runtime::Object;
Expand Down
4 changes: 2 additions & 2 deletions tests/expectations/tests/objc_pointer_return_types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use objc::{self, class, msg_send, sel, sel_impl};
#[allow(non_camel_case_types)]
pub type id = *mut objc::runtime::Object;
#[repr(transparent)]
#[derive(Clone)]
#[derive(Debug, Copy, Clone)]
pub struct Bar(pub id);
impl std::ops::Deref for Bar {
type Target = objc::runtime::Object;
Expand All @@ -27,7 +27,7 @@ impl Bar {
impl IBar for Bar {}
pub trait IBar: Sized + std::ops::Deref {}
#[repr(transparent)]
#[derive(Clone)]
#[derive(Debug, Copy, Clone)]
pub struct Foo(pub id);
impl std::ops::Deref for Foo {
type Target = objc::runtime::Object;
Expand Down
2 changes: 1 addition & 1 deletion tests/expectations/tests/objc_property_fnptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ use objc::{self, class, msg_send, sel, sel_impl};
#[allow(non_camel_case_types)]
pub type id = *mut objc::runtime::Object;
#[repr(transparent)]
#[derive(Clone)]
#[derive(Debug, Copy, Clone)]
pub struct Foo(pub id);
impl std::ops::Deref for Foo {
type Target = objc::runtime::Object;
Expand Down
2 changes: 1 addition & 1 deletion tests/expectations/tests/objc_protocol.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use objc::{self, class, msg_send, sel, sel_impl};
pub type id = *mut objc::runtime::Object;
pub trait PFoo: Sized + std::ops::Deref {}
#[repr(transparent)]
#[derive(Clone)]
#[derive(Debug, Copy, Clone)]
pub struct Foo(pub id);
impl std::ops::Deref for Foo {
type Target = objc::runtime::Object;
Expand Down
4 changes: 2 additions & 2 deletions tests/expectations/tests/objc_protocol_inheritance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ use objc::{self, class, msg_send, sel, sel_impl};
pub type id = *mut objc::runtime::Object;
pub trait PFoo: Sized + std::ops::Deref {}
#[repr(transparent)]
#[derive(Clone)]
#[derive(Debug, Copy, Clone)]
pub struct Foo(pub id);
impl std::ops::Deref for Foo {
type Target = objc::runtime::Object;
Expand All @@ -29,7 +29,7 @@ impl PFoo for Foo {}
impl IFoo for Foo {}
pub trait IFoo: Sized + std::ops::Deref {}
#[repr(transparent)]
#[derive(Clone)]
#[derive(Debug, Copy, Clone)]
pub struct Bar(pub id);
impl std::ops::Deref for Bar {
type Target = objc::runtime::Object;
Expand Down

0 comments on commit bb7fd33

Please sign in to comment.