objc2_core_data/generated/
NSRelationshipDescription.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6use objc2_foundation::*;
7
8use crate::*;
9
10/// [Apple's documentation](https://developer.apple.com/documentation/coredata/nsdeleterule?language=objc)
11// NS_ENUM
12#[repr(transparent)]
13#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
14pub struct NSDeleteRule(pub NSUInteger);
15impl NSDeleteRule {
16    #[doc(alias = "NSNoActionDeleteRule")]
17    pub const NoActionDeleteRule: Self = Self(0);
18    #[doc(alias = "NSNullifyDeleteRule")]
19    pub const NullifyDeleteRule: Self = Self(1);
20    #[doc(alias = "NSCascadeDeleteRule")]
21    pub const CascadeDeleteRule: Self = Self(2);
22    #[doc(alias = "NSDenyDeleteRule")]
23    pub const DenyDeleteRule: Self = Self(3);
24}
25
26unsafe impl Encode for NSDeleteRule {
27    const ENCODING: Encoding = NSUInteger::ENCODING;
28}
29
30unsafe impl RefEncode for NSDeleteRule {
31    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
32}
33
34extern_class!(
35    /// [Apple's documentation](https://developer.apple.com/documentation/coredata/nsrelationshipdescription?language=objc)
36    #[unsafe(super(NSPropertyDescription, NSObject))]
37    #[derive(Debug, PartialEq, Eq, Hash)]
38    #[cfg(feature = "NSPropertyDescription")]
39    pub struct NSRelationshipDescription;
40);
41
42#[cfg(feature = "NSPropertyDescription")]
43extern_conformance!(
44    unsafe impl NSCoding for NSRelationshipDescription {}
45);
46
47#[cfg(feature = "NSPropertyDescription")]
48extern_conformance!(
49    unsafe impl NSCopying for NSRelationshipDescription {}
50);
51
52#[cfg(feature = "NSPropertyDescription")]
53unsafe impl CopyingHelper for NSRelationshipDescription {
54    type Result = Self;
55}
56
57#[cfg(feature = "NSPropertyDescription")]
58extern_conformance!(
59    unsafe impl NSObjectProtocol for NSRelationshipDescription {}
60);
61
62#[cfg(feature = "NSPropertyDescription")]
63impl NSRelationshipDescription {
64    extern_methods!(
65        #[cfg(feature = "NSEntityDescription")]
66        /// # Safety
67        ///
68        /// This is not retained internally, you must ensure the object is still alive.
69        #[unsafe(method(destinationEntity))]
70        #[unsafe(method_family = none)]
71        pub unsafe fn destinationEntity(&self) -> Option<Retained<NSEntityDescription>>;
72
73        #[cfg(feature = "NSEntityDescription")]
74        /// Setter for [`destinationEntity`][Self::destinationEntity].
75        ///
76        /// # Safety
77        ///
78        /// This is unretained, you must ensure the object is kept alive while in use.
79        #[unsafe(method(setDestinationEntity:))]
80        #[unsafe(method_family = none)]
81        pub unsafe fn setDestinationEntity(&self, destination_entity: Option<&NSEntityDescription>);
82
83        /// # Safety
84        ///
85        /// This is not retained internally, you must ensure the object is still alive.
86        #[unsafe(method(inverseRelationship))]
87        #[unsafe(method_family = none)]
88        pub unsafe fn inverseRelationship(&self) -> Option<Retained<NSRelationshipDescription>>;
89
90        /// Setter for [`inverseRelationship`][Self::inverseRelationship].
91        ///
92        /// # Safety
93        ///
94        /// This is unretained, you must ensure the object is kept alive while in use.
95        #[unsafe(method(setInverseRelationship:))]
96        #[unsafe(method_family = none)]
97        pub unsafe fn setInverseRelationship(
98            &self,
99            inverse_relationship: Option<&NSRelationshipDescription>,
100        );
101
102        #[unsafe(method(maxCount))]
103        #[unsafe(method_family = none)]
104        pub unsafe fn maxCount(&self) -> NSUInteger;
105
106        /// Setter for [`maxCount`][Self::maxCount].
107        #[unsafe(method(setMaxCount:))]
108        #[unsafe(method_family = none)]
109        pub unsafe fn setMaxCount(&self, max_count: NSUInteger);
110
111        #[unsafe(method(minCount))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn minCount(&self) -> NSUInteger;
114
115        /// Setter for [`minCount`][Self::minCount].
116        #[unsafe(method(setMinCount:))]
117        #[unsafe(method_family = none)]
118        pub unsafe fn setMinCount(&self, min_count: NSUInteger);
119
120        #[unsafe(method(deleteRule))]
121        #[unsafe(method_family = none)]
122        pub unsafe fn deleteRule(&self) -> NSDeleteRule;
123
124        /// Setter for [`deleteRule`][Self::deleteRule].
125        #[unsafe(method(setDeleteRule:))]
126        #[unsafe(method_family = none)]
127        pub unsafe fn setDeleteRule(&self, delete_rule: NSDeleteRule);
128
129        #[unsafe(method(isToMany))]
130        #[unsafe(method_family = none)]
131        pub unsafe fn isToMany(&self) -> bool;
132
133        #[unsafe(method(versionHash))]
134        #[unsafe(method_family = none)]
135        pub unsafe fn versionHash(&self) -> Retained<NSData>;
136
137        #[unsafe(method(isOrdered))]
138        #[unsafe(method_family = none)]
139        pub unsafe fn isOrdered(&self) -> bool;
140
141        /// Setter for [`isOrdered`][Self::isOrdered].
142        #[unsafe(method(setOrdered:))]
143        #[unsafe(method_family = none)]
144        pub unsafe fn setOrdered(&self, ordered: bool);
145    );
146}
147
148/// Methods declared on superclass `NSObject`.
149#[cfg(feature = "NSPropertyDescription")]
150impl NSRelationshipDescription {
151    extern_methods!(
152        #[unsafe(method(init))]
153        #[unsafe(method_family = init)]
154        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
155
156        #[unsafe(method(new))]
157        #[unsafe(method_family = new)]
158        pub unsafe fn new() -> Retained<Self>;
159    );
160}