Source code

Revision control

Copy as Markdown

Other Tools

//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
use objc2::__framework_prelude::*;
use crate::*;
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSCollectionChangeType(pub NSInteger);
impl NSCollectionChangeType {
#[doc(alias = "NSCollectionChangeInsert")]
pub const Insert: Self = Self(0);
#[doc(alias = "NSCollectionChangeRemove")]
pub const Remove: Self = Self(1);
}
unsafe impl Encode for NSCollectionChangeType {
const ENCODING: Encoding = NSInteger::ENCODING;
}
unsafe impl RefEncode for NSCollectionChangeType {
const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}
extern_class!(
#[unsafe(super(NSObject))]
#[derive(Debug, PartialEq, Eq, Hash)]
pub struct NSOrderedCollectionChange<ObjectType: ?Sized = AnyObject>;
);
impl<ObjectType: ?Sized + Message> NSOrderedCollectionChange<ObjectType> {
/// Unchecked conversion of the generic parameter.
///
/// # Safety
///
/// The generic must be valid to reinterpret as the given type.
#[inline]
pub unsafe fn cast_unchecked<NewObjectType: ?Sized + Message>(
&self,
) -> &NSOrderedCollectionChange<NewObjectType> {
unsafe { &*((self as *const Self).cast()) }
}
}
extern_conformance!(
unsafe impl<ObjectType: ?Sized> NSObjectProtocol for NSOrderedCollectionChange<ObjectType> {}
);
impl<ObjectType: Message> NSOrderedCollectionChange<ObjectType> {
extern_methods!(
#[unsafe(method(changeWithObject:type:index:))]
#[unsafe(method_family = none)]
pub fn changeWithObject_type_index(
an_object: Option<&ObjectType>,
r#type: NSCollectionChangeType,
index: NSUInteger,
) -> Retained<NSOrderedCollectionChange<ObjectType>>;
#[unsafe(method(changeWithObject:type:index:associatedIndex:))]
#[unsafe(method_family = none)]
pub fn changeWithObject_type_index_associatedIndex(
an_object: Option<&ObjectType>,
r#type: NSCollectionChangeType,
index: NSUInteger,
associated_index: NSUInteger,
) -> Retained<NSOrderedCollectionChange<ObjectType>>;
#[unsafe(method(object))]
#[unsafe(method_family = none)]
pub fn object(&self) -> Option<Retained<ObjectType>>;
#[unsafe(method(changeType))]
#[unsafe(method_family = none)]
pub fn changeType(&self) -> NSCollectionChangeType;
#[unsafe(method(index))]
#[unsafe(method_family = none)]
pub fn index(&self) -> NSUInteger;
#[unsafe(method(associatedIndex))]
#[unsafe(method_family = none)]
pub fn associatedIndex(&self) -> NSUInteger;
#[unsafe(method(init))]
#[unsafe(method_family = init)]
pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
#[unsafe(method(initWithObject:type:index:))]
#[unsafe(method_family = init)]
pub fn initWithObject_type_index(
this: Allocated<Self>,
an_object: Option<&ObjectType>,
r#type: NSCollectionChangeType,
index: NSUInteger,
) -> Retained<Self>;
#[unsafe(method(initWithObject:type:index:associatedIndex:))]
#[unsafe(method_family = init)]
pub fn initWithObject_type_index_associatedIndex(
this: Allocated<Self>,
an_object: Option<&ObjectType>,
r#type: NSCollectionChangeType,
index: NSUInteger,
associated_index: NSUInteger,
) -> Retained<Self>;
);
}
/// Methods declared on superclass `NSObject`.
impl<ObjectType: Message> NSOrderedCollectionChange<ObjectType> {
extern_methods!(
#[unsafe(method(new))]
#[unsafe(method_family = new)]
pub unsafe fn new() -> Retained<Self>;
);
}