#![allow(dead_code, unused_imports)]
use core::marker::PhantomData;
use core::panic::{RefUnwindSafe, UnwindSafe};
use objc2::rc::Retained;
use objc2::runtime::{AnyObject, NSObject};
use objc2::{__inner_extern_class, mutability, ClassType, Message};
#[derive(PartialEq, Eq, Hash, PartialOrd, Ord, Clone, Copy, Debug)]
#[repr(transparent)]
struct UnsafeIgnoreAutoTraits<T: ?Sized>(T);
unsafe impl<T: ?Sized> Send for UnsafeIgnoreAutoTraits<T> {}
unsafe impl<T: ?Sized> Sync for UnsafeIgnoreAutoTraits<T> {}
impl<T: ?Sized> RefUnwindSafe for UnsafeIgnoreAutoTraits<T> {}
impl<T: ?Sized> UnwindSafe for UnsafeIgnoreAutoTraits<T> {}
__inner_extern_class!(
#[derive(PartialEq, Eq, Hash)]
#[cfg(feature = "NSArray")]
pub struct NSArray<ObjectType: ?Sized = AnyObject> {
__superclass: UnsafeIgnoreAutoTraits<NSObject>,
__inner: PhantomData<Retained<ObjectType>>,
}
#[cfg(feature = "NSArray")]
unsafe impl<ObjectType: ?Sized + Message> ClassType for NSArray<ObjectType> {
type Super = NSObject;
type Mutability = mutability::ImmutableWithMutableSubclass<NSMutableArray<ObjectType>>;
fn as_super(&self) -> &Self::Super {
&self.__superclass.0
}
fn as_super_mut(&mut self) -> &mut Self::Super {
&mut self.__superclass.0
}
}
);
__inner_extern_class!(
#[derive(PartialEq, Eq, Hash)]
#[cfg(feature = "NSArray")]
pub struct NSMutableArray<ObjectType: ?Sized = AnyObject> {
__superclass: NSArray<ObjectType>,
}
#[cfg(feature = "NSArray")]
unsafe impl<ObjectType: ?Sized + Message> ClassType for NSMutableArray<ObjectType> {
#[inherits(NSObject)]
type Super = NSArray<ObjectType>;
type Mutability = mutability::MutableWithImmutableSuperclass<NSArray<ObjectType>>;
fn as_super(&self) -> &Self::Super {
&self.__superclass
}
fn as_super_mut(&mut self) -> &mut Self::Super {
&mut self.__superclass
}
}
);
__inner_extern_class!(
#[derive(PartialEq, Eq, Hash)]
#[cfg(feature = "NSDictionary")]
pub struct NSDictionary<KeyType: ?Sized = AnyObject, ObjectType: ?Sized = AnyObject> {
__superclass: UnsafeIgnoreAutoTraits<NSObject>,
__inner: PhantomData<(Retained<KeyType>, Retained<ObjectType>)>,
}
#[cfg(feature = "NSDictionary")]
unsafe impl<KeyType: ?Sized + Message, ObjectType: ?Sized + Message> ClassType
for NSDictionary<KeyType, ObjectType>
{
type Super = NSObject;
type Mutability =
mutability::ImmutableWithMutableSubclass<NSMutableDictionary<KeyType, ObjectType>>;
fn as_super(&self) -> &Self::Super {
&self.__superclass.0
}
fn as_super_mut(&mut self) -> &mut Self::Super {
&mut self.__superclass.0
}
}
);
__inner_extern_class!(
#[derive(PartialEq, Eq, Hash)]
#[cfg(feature = "NSDictionary")]
pub struct NSMutableDictionary<KeyType: ?Sized = AnyObject, ObjectType: ?Sized = AnyObject> {
__superclass: NSDictionary<KeyType, ObjectType>,
}
#[cfg(feature = "NSDictionary")]
unsafe impl<KeyType: ?Sized + Message, ObjectType: ?Sized + Message> ClassType
for NSMutableDictionary<KeyType, ObjectType>
{
#[inherits(NSObject)]
type Super = NSDictionary<KeyType, ObjectType>;
type Mutability =
mutability::MutableWithImmutableSuperclass<NSDictionary<KeyType, ObjectType>>;
fn as_super(&self) -> &Self::Super {
&self.__superclass
}
fn as_super_mut(&mut self) -> &mut Self::Super {
&mut self.__superclass
}
}
);
__inner_extern_class!(
#[derive(PartialEq, Eq, Hash)]
#[cfg(feature = "NSSet")]
pub struct NSSet<ObjectType: ?Sized = AnyObject> {
__superclass: UnsafeIgnoreAutoTraits<NSObject>,
__inner: PhantomData<Retained<ObjectType>>,
}
#[cfg(feature = "NSSet")]
unsafe impl<ObjectType: ?Sized + Message> ClassType for NSSet<ObjectType> {
type Super = NSObject;
type Mutability = mutability::ImmutableWithMutableSubclass<NSMutableSet<ObjectType>>;
fn as_super(&self) -> &Self::Super {
&self.__superclass.0
}
fn as_super_mut(&mut self) -> &mut Self::Super {
&mut self.__superclass.0
}
}
);
__inner_extern_class!(
#[derive(PartialEq, Eq, Hash)]
#[cfg(feature = "NSSet")]
pub struct NSMutableSet<ObjectType: ?Sized = AnyObject> {
__superclass: NSSet<ObjectType>,
}
#[cfg(feature = "NSSet")]
unsafe impl<ObjectType: ?Sized + Message> ClassType for NSMutableSet<ObjectType> {
#[inherits(NSObject)]
type Super = NSSet<ObjectType>;
type Mutability = mutability::MutableWithImmutableSuperclass<NSSet<ObjectType>>;
fn as_super(&self) -> &Self::Super {
&self.__superclass
}
fn as_super_mut(&mut self) -> &mut Self::Super {
&mut self.__superclass
}
}
);
__inner_extern_class!(
#[derive(PartialEq, Eq, Hash)]
#[cfg(feature = "NSSet")]
pub struct NSCountedSet<ObjectType: ?Sized = AnyObject> {
__superclass: NSMutableSet<ObjectType>,
}
#[cfg(feature = "NSSet")]
unsafe impl<ObjectType: ?Sized + Message> ClassType for NSCountedSet<ObjectType> {
#[inherits(NSSet<ObjectType>, NSObject)]
type Super = NSMutableSet<ObjectType>;
type Mutability = mutability::Mutable;
fn as_super(&self) -> &Self::Super {
&self.__superclass
}
fn as_super_mut(&mut self) -> &mut Self::Super {
&mut self.__superclass
}
}
);
__inner_extern_class!(
#[derive(PartialEq, Eq, Hash)]
#[cfg(feature = "NSOrderedSet")]
pub struct NSOrderedSet<ObjectType: ?Sized = AnyObject> {
__superclass: UnsafeIgnoreAutoTraits<NSObject>,
__inner: PhantomData<Retained<ObjectType>>,
}
#[cfg(feature = "NSOrderedSet")]
unsafe impl<ObjectType: ?Sized + Message> ClassType for NSOrderedSet<ObjectType> {
type Super = NSObject;
type Mutability = mutability::ImmutableWithMutableSubclass<NSMutableOrderedSet<ObjectType>>;
fn as_super(&self) -> &Self::Super {
&self.__superclass.0
}
fn as_super_mut(&mut self) -> &mut Self::Super {
&mut self.__superclass.0
}
}
);
__inner_extern_class!(
#[derive(PartialEq, Eq, Hash)]
#[cfg(feature = "NSOrderedSet")]
pub struct NSMutableOrderedSet<ObjectType: ?Sized = AnyObject> {
__superclass: NSOrderedSet<ObjectType>,
}
#[cfg(feature = "NSOrderedSet")]
unsafe impl<ObjectType: ?Sized + Message> ClassType for NSMutableOrderedSet<ObjectType> {
#[inherits(NSObject)]
type Super = NSOrderedSet<ObjectType>;
type Mutability = mutability::MutableWithImmutableSuperclass<NSOrderedSet<ObjectType>>;
fn as_super(&self) -> &Self::Super {
&self.__superclass
}
fn as_super_mut(&mut self) -> &mut Self::Super {
&mut self.__superclass
}
}
);
__inner_extern_class!(
#[derive(Debug, PartialEq, Eq, Hash)]
#[cfg(feature = "NSEnumerator")]
pub struct NSEnumerator<ObjectType: ?Sized = AnyObject> {
__superclass: UnsafeIgnoreAutoTraits<NSObject>,
__inner: PhantomData<Retained<ObjectType>>,
}
#[cfg(feature = "NSEnumerator")]
unsafe impl<ObjectType: ?Sized + Message> ClassType for NSEnumerator<ObjectType> {
type Super = NSObject;
type Mutability = mutability::Mutable;
fn as_super(&self) -> &Self::Super {
&self.__superclass.0
}
fn as_super_mut(&mut self) -> &mut Self::Super {
&mut self.__superclass.0
}
}
);