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        #[unsafe(method(destinationEntity))]
67        #[unsafe(method_family = none)]
68        pub unsafe fn destinationEntity(&self) -> Option<Retained<NSEntityDescription>>;
69
70        #[cfg(feature = "NSEntityDescription")]
71        /// Setter for [`destinationEntity`][Self::destinationEntity].
72        #[unsafe(method(setDestinationEntity:))]
73        #[unsafe(method_family = none)]
74        pub unsafe fn setDestinationEntity(&self, destination_entity: Option<&NSEntityDescription>);
75
76        #[unsafe(method(inverseRelationship))]
77        #[unsafe(method_family = none)]
78        pub unsafe fn inverseRelationship(&self) -> Option<Retained<NSRelationshipDescription>>;
79
80        /// Setter for [`inverseRelationship`][Self::inverseRelationship].
81        #[unsafe(method(setInverseRelationship:))]
82        #[unsafe(method_family = none)]
83        pub unsafe fn setInverseRelationship(
84            &self,
85            inverse_relationship: Option<&NSRelationshipDescription>,
86        );
87
88        #[unsafe(method(maxCount))]
89        #[unsafe(method_family = none)]
90        pub unsafe fn maxCount(&self) -> NSUInteger;
91
92        /// Setter for [`maxCount`][Self::maxCount].
93        #[unsafe(method(setMaxCount:))]
94        #[unsafe(method_family = none)]
95        pub unsafe fn setMaxCount(&self, max_count: NSUInteger);
96
97        #[unsafe(method(minCount))]
98        #[unsafe(method_family = none)]
99        pub unsafe fn minCount(&self) -> NSUInteger;
100
101        /// Setter for [`minCount`][Self::minCount].
102        #[unsafe(method(setMinCount:))]
103        #[unsafe(method_family = none)]
104        pub unsafe fn setMinCount(&self, min_count: NSUInteger);
105
106        #[unsafe(method(deleteRule))]
107        #[unsafe(method_family = none)]
108        pub unsafe fn deleteRule(&self) -> NSDeleteRule;
109
110        /// Setter for [`deleteRule`][Self::deleteRule].
111        #[unsafe(method(setDeleteRule:))]
112        #[unsafe(method_family = none)]
113        pub unsafe fn setDeleteRule(&self, delete_rule: NSDeleteRule);
114
115        #[unsafe(method(isToMany))]
116        #[unsafe(method_family = none)]
117        pub unsafe fn isToMany(&self) -> bool;
118
119        #[unsafe(method(versionHash))]
120        #[unsafe(method_family = none)]
121        pub unsafe fn versionHash(&self) -> Retained<NSData>;
122
123        #[unsafe(method(isOrdered))]
124        #[unsafe(method_family = none)]
125        pub unsafe fn isOrdered(&self) -> bool;
126
127        /// Setter for [`isOrdered`][Self::isOrdered].
128        #[unsafe(method(setOrdered:))]
129        #[unsafe(method_family = none)]
130        pub unsafe fn setOrdered(&self, ordered: bool);
131    );
132}
133
134/// Methods declared on superclass `NSObject`.
135#[cfg(feature = "NSPropertyDescription")]
136impl NSRelationshipDescription {
137    extern_methods!(
138        #[unsafe(method(init))]
139        #[unsafe(method_family = init)]
140        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
141
142        #[unsafe(method(new))]
143        #[unsafe(method_family = new)]
144        pub unsafe fn new() -> Retained<Self>;
145    );
146}