objc2_ui_kit/generated/
NSLayoutAnchor.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ptr::NonNull;
4use objc2::__framework_prelude::*;
5#[cfg(feature = "objc2-core-foundation")]
6use objc2_core_foundation::*;
7use objc2_foundation::*;
8
9use crate::*;
10
11extern_class!(
12    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nslayoutanchor?language=objc)
13    #[unsafe(super(NSObject))]
14    #[thread_kind = MainThreadOnly]
15    #[derive(Debug, PartialEq, Eq, Hash)]
16    pub struct NSLayoutAnchor<AnchorType: ?Sized = AnyObject>;
17);
18
19impl<AnchorType: ?Sized + Message> NSLayoutAnchor<AnchorType> {
20    /// Unchecked conversion of the generic parameter.
21    ///
22    /// # Safety
23    ///
24    /// The generic must be valid to reinterpret as the given type.
25    #[inline]
26    pub unsafe fn cast_unchecked<NewAnchorType: ?Sized + Message>(
27        &self,
28    ) -> &NSLayoutAnchor<NewAnchorType> {
29        unsafe { &*((self as *const Self).cast()) }
30    }
31}
32
33extern_conformance!(
34    unsafe impl<AnchorType: ?Sized + NSCoding> NSCoding for NSLayoutAnchor<AnchorType> {}
35);
36
37extern_conformance!(
38    unsafe impl<AnchorType: ?Sized> NSCopying for NSLayoutAnchor<AnchorType> {}
39);
40
41unsafe impl<AnchorType: ?Sized + Message> CopyingHelper for NSLayoutAnchor<AnchorType> {
42    type Result = Self;
43}
44
45extern_conformance!(
46    unsafe impl<AnchorType: ?Sized> NSObjectProtocol for NSLayoutAnchor<AnchorType> {}
47);
48
49impl<AnchorType: Message> NSLayoutAnchor<AnchorType> {
50    extern_methods!(
51        #[cfg(feature = "NSLayoutConstraint")]
52        #[must_use]
53        #[unsafe(method(constraintEqualToAnchor:))]
54        #[unsafe(method_family = none)]
55        pub fn constraintEqualToAnchor(
56            &self,
57            anchor: &NSLayoutAnchor<AnchorType>,
58        ) -> Retained<NSLayoutConstraint>;
59
60        #[cfg(feature = "NSLayoutConstraint")]
61        #[must_use]
62        #[unsafe(method(constraintGreaterThanOrEqualToAnchor:))]
63        #[unsafe(method_family = none)]
64        pub fn constraintGreaterThanOrEqualToAnchor(
65            &self,
66            anchor: &NSLayoutAnchor<AnchorType>,
67        ) -> Retained<NSLayoutConstraint>;
68
69        #[cfg(feature = "NSLayoutConstraint")]
70        #[must_use]
71        #[unsafe(method(constraintLessThanOrEqualToAnchor:))]
72        #[unsafe(method_family = none)]
73        pub fn constraintLessThanOrEqualToAnchor(
74            &self,
75            anchor: &NSLayoutAnchor<AnchorType>,
76        ) -> Retained<NSLayoutConstraint>;
77
78        #[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
79        #[must_use]
80        #[unsafe(method(constraintEqualToAnchor:constant:))]
81        #[unsafe(method_family = none)]
82        pub fn constraintEqualToAnchor_constant(
83            &self,
84            anchor: &NSLayoutAnchor<AnchorType>,
85            c: CGFloat,
86        ) -> Retained<NSLayoutConstraint>;
87
88        #[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
89        #[must_use]
90        #[unsafe(method(constraintGreaterThanOrEqualToAnchor:constant:))]
91        #[unsafe(method_family = none)]
92        pub fn constraintGreaterThanOrEqualToAnchor_constant(
93            &self,
94            anchor: &NSLayoutAnchor<AnchorType>,
95            c: CGFloat,
96        ) -> Retained<NSLayoutConstraint>;
97
98        #[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
99        #[must_use]
100        #[unsafe(method(constraintLessThanOrEqualToAnchor:constant:))]
101        #[unsafe(method_family = none)]
102        pub fn constraintLessThanOrEqualToAnchor_constant(
103            &self,
104            anchor: &NSLayoutAnchor<AnchorType>,
105            c: CGFloat,
106        ) -> Retained<NSLayoutConstraint>;
107
108        #[unsafe(method(name))]
109        #[unsafe(method_family = none)]
110        pub fn name(&self) -> Retained<NSString>;
111
112        #[unsafe(method(item))]
113        #[unsafe(method_family = none)]
114        pub fn item(&self) -> Option<Retained<AnyObject>>;
115
116        #[unsafe(method(hasAmbiguousLayout))]
117        #[unsafe(method_family = none)]
118        pub fn hasAmbiguousLayout(&self) -> bool;
119
120        #[cfg(feature = "NSLayoutConstraint")]
121        #[unsafe(method(constraintsAffectingLayout))]
122        #[unsafe(method_family = none)]
123        pub fn constraintsAffectingLayout(&self) -> Retained<NSArray<NSLayoutConstraint>>;
124    );
125}
126
127/// Methods declared on superclass `NSObject`.
128impl<AnchorType: Message> NSLayoutAnchor<AnchorType> {
129    extern_methods!(
130        #[unsafe(method(init))]
131        #[unsafe(method_family = init)]
132        pub fn init(this: Allocated<Self>) -> Retained<Self>;
133
134        #[unsafe(method(new))]
135        #[unsafe(method_family = new)]
136        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
137    );
138}
139
140extern_class!(
141    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nslayoutxaxisanchor?language=objc)
142    #[unsafe(super(NSLayoutAnchor, NSObject))]
143    #[thread_kind = MainThreadOnly]
144    #[derive(Debug)]
145    pub struct NSLayoutXAxisAnchor;
146);
147
148extern_conformance!(
149    unsafe impl NSCoding for NSLayoutXAxisAnchor {}
150);
151
152extern_conformance!(
153    unsafe impl NSCopying for NSLayoutXAxisAnchor {}
154);
155
156unsafe impl CopyingHelper for NSLayoutXAxisAnchor {
157    type Result = Self;
158}
159
160extern_conformance!(
161    unsafe impl NSObjectProtocol for NSLayoutXAxisAnchor {}
162);
163
164impl NSLayoutXAxisAnchor {
165    extern_methods!(
166        #[unsafe(method(anchorWithOffsetToAnchor:))]
167        #[unsafe(method_family = none)]
168        pub fn anchorWithOffsetToAnchor(
169            &self,
170            other_anchor: &NSLayoutXAxisAnchor,
171        ) -> Retained<NSLayoutDimension>;
172    );
173}
174
175/// Methods declared on superclass `NSObject`.
176impl NSLayoutXAxisAnchor {
177    extern_methods!(
178        #[unsafe(method(init))]
179        #[unsafe(method_family = init)]
180        pub fn init(this: Allocated<Self>) -> Retained<Self>;
181
182        #[unsafe(method(new))]
183        #[unsafe(method_family = new)]
184        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
185    );
186}
187
188extern_class!(
189    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nslayoutyaxisanchor?language=objc)
190    #[unsafe(super(NSLayoutAnchor, NSObject))]
191    #[thread_kind = MainThreadOnly]
192    #[derive(Debug)]
193    pub struct NSLayoutYAxisAnchor;
194);
195
196extern_conformance!(
197    unsafe impl NSCoding for NSLayoutYAxisAnchor {}
198);
199
200extern_conformance!(
201    unsafe impl NSCopying for NSLayoutYAxisAnchor {}
202);
203
204unsafe impl CopyingHelper for NSLayoutYAxisAnchor {
205    type Result = Self;
206}
207
208extern_conformance!(
209    unsafe impl NSObjectProtocol for NSLayoutYAxisAnchor {}
210);
211
212impl NSLayoutYAxisAnchor {
213    extern_methods!(
214        #[unsafe(method(anchorWithOffsetToAnchor:))]
215        #[unsafe(method_family = none)]
216        pub fn anchorWithOffsetToAnchor(
217            &self,
218            other_anchor: &NSLayoutYAxisAnchor,
219        ) -> Retained<NSLayoutDimension>;
220    );
221}
222
223/// Methods declared on superclass `NSObject`.
224impl NSLayoutYAxisAnchor {
225    extern_methods!(
226        #[unsafe(method(init))]
227        #[unsafe(method_family = init)]
228        pub fn init(this: Allocated<Self>) -> Retained<Self>;
229
230        #[unsafe(method(new))]
231        #[unsafe(method_family = new)]
232        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
233    );
234}
235
236extern_class!(
237    /// [Apple's documentation](https://developer.apple.com/documentation/uikit/nslayoutdimension?language=objc)
238    #[unsafe(super(NSLayoutAnchor, NSObject))]
239    #[thread_kind = MainThreadOnly]
240    #[derive(Debug)]
241    pub struct NSLayoutDimension;
242);
243
244extern_conformance!(
245    unsafe impl NSCoding for NSLayoutDimension {}
246);
247
248extern_conformance!(
249    unsafe impl NSCopying for NSLayoutDimension {}
250);
251
252unsafe impl CopyingHelper for NSLayoutDimension {
253    type Result = Self;
254}
255
256extern_conformance!(
257    unsafe impl NSObjectProtocol for NSLayoutDimension {}
258);
259
260impl NSLayoutDimension {
261    extern_methods!(
262        #[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
263        #[must_use]
264        #[unsafe(method(constraintEqualToConstant:))]
265        #[unsafe(method_family = none)]
266        pub fn constraintEqualToConstant(&self, c: CGFloat) -> Retained<NSLayoutConstraint>;
267
268        #[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
269        #[must_use]
270        #[unsafe(method(constraintGreaterThanOrEqualToConstant:))]
271        #[unsafe(method_family = none)]
272        pub fn constraintGreaterThanOrEqualToConstant(
273            &self,
274            c: CGFloat,
275        ) -> Retained<NSLayoutConstraint>;
276
277        #[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
278        #[must_use]
279        #[unsafe(method(constraintLessThanOrEqualToConstant:))]
280        #[unsafe(method_family = none)]
281        pub fn constraintLessThanOrEqualToConstant(
282            &self,
283            c: CGFloat,
284        ) -> Retained<NSLayoutConstraint>;
285
286        #[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
287        #[must_use]
288        #[unsafe(method(constraintEqualToAnchor:multiplier:))]
289        #[unsafe(method_family = none)]
290        pub fn constraintEqualToAnchor_multiplier(
291            &self,
292            anchor: &NSLayoutDimension,
293            m: CGFloat,
294        ) -> Retained<NSLayoutConstraint>;
295
296        #[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
297        #[must_use]
298        #[unsafe(method(constraintGreaterThanOrEqualToAnchor:multiplier:))]
299        #[unsafe(method_family = none)]
300        pub fn constraintGreaterThanOrEqualToAnchor_multiplier(
301            &self,
302            anchor: &NSLayoutDimension,
303            m: CGFloat,
304        ) -> Retained<NSLayoutConstraint>;
305
306        #[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
307        #[must_use]
308        #[unsafe(method(constraintLessThanOrEqualToAnchor:multiplier:))]
309        #[unsafe(method_family = none)]
310        pub fn constraintLessThanOrEqualToAnchor_multiplier(
311            &self,
312            anchor: &NSLayoutDimension,
313            m: CGFloat,
314        ) -> Retained<NSLayoutConstraint>;
315
316        #[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
317        #[must_use]
318        #[unsafe(method(constraintEqualToAnchor:multiplier:constant:))]
319        #[unsafe(method_family = none)]
320        pub fn constraintEqualToAnchor_multiplier_constant(
321            &self,
322            anchor: &NSLayoutDimension,
323            m: CGFloat,
324            c: CGFloat,
325        ) -> Retained<NSLayoutConstraint>;
326
327        #[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
328        #[must_use]
329        #[unsafe(method(constraintGreaterThanOrEqualToAnchor:multiplier:constant:))]
330        #[unsafe(method_family = none)]
331        pub fn constraintGreaterThanOrEqualToAnchor_multiplier_constant(
332            &self,
333            anchor: &NSLayoutDimension,
334            m: CGFloat,
335            c: CGFloat,
336        ) -> Retained<NSLayoutConstraint>;
337
338        #[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
339        #[must_use]
340        #[unsafe(method(constraintLessThanOrEqualToAnchor:multiplier:constant:))]
341        #[unsafe(method_family = none)]
342        pub fn constraintLessThanOrEqualToAnchor_multiplier_constant(
343            &self,
344            anchor: &NSLayoutDimension,
345            m: CGFloat,
346            c: CGFloat,
347        ) -> Retained<NSLayoutConstraint>;
348    );
349}
350
351/// Methods declared on superclass `NSObject`.
352impl NSLayoutDimension {
353    extern_methods!(
354        #[unsafe(method(init))]
355        #[unsafe(method_family = init)]
356        pub fn init(this: Allocated<Self>) -> Retained<Self>;
357
358        #[unsafe(method(new))]
359        #[unsafe(method_family = new)]
360        pub fn new(mtm: MainThreadMarker) -> Retained<Self>;
361    );
362}
363
364/// UIViewDynamicSystemSpacingSupport.
365impl NSLayoutXAxisAnchor {
366    extern_methods!(
367        #[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
368        #[must_use]
369        #[unsafe(method(constraintEqualToSystemSpacingAfterAnchor:multiplier:))]
370        #[unsafe(method_family = none)]
371        pub fn constraintEqualToSystemSpacingAfterAnchor_multiplier(
372            &self,
373            anchor: &NSLayoutXAxisAnchor,
374            multiplier: CGFloat,
375        ) -> Retained<NSLayoutConstraint>;
376
377        #[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
378        #[must_use]
379        #[unsafe(method(constraintGreaterThanOrEqualToSystemSpacingAfterAnchor:multiplier:))]
380        #[unsafe(method_family = none)]
381        pub fn constraintGreaterThanOrEqualToSystemSpacingAfterAnchor_multiplier(
382            &self,
383            anchor: &NSLayoutXAxisAnchor,
384            multiplier: CGFloat,
385        ) -> Retained<NSLayoutConstraint>;
386
387        #[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
388        #[must_use]
389        #[unsafe(method(constraintLessThanOrEqualToSystemSpacingAfterAnchor:multiplier:))]
390        #[unsafe(method_family = none)]
391        pub fn constraintLessThanOrEqualToSystemSpacingAfterAnchor_multiplier(
392            &self,
393            anchor: &NSLayoutXAxisAnchor,
394            multiplier: CGFloat,
395        ) -> Retained<NSLayoutConstraint>;
396    );
397}
398
399/// UIViewDynamicSystemSpacingSupport.
400impl NSLayoutYAxisAnchor {
401    extern_methods!(
402        #[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
403        #[must_use]
404        #[unsafe(method(constraintEqualToSystemSpacingBelowAnchor:multiplier:))]
405        #[unsafe(method_family = none)]
406        pub fn constraintEqualToSystemSpacingBelowAnchor_multiplier(
407            &self,
408            anchor: &NSLayoutYAxisAnchor,
409            multiplier: CGFloat,
410        ) -> Retained<NSLayoutConstraint>;
411
412        #[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
413        #[must_use]
414        #[unsafe(method(constraintGreaterThanOrEqualToSystemSpacingBelowAnchor:multiplier:))]
415        #[unsafe(method_family = none)]
416        pub fn constraintGreaterThanOrEqualToSystemSpacingBelowAnchor_multiplier(
417            &self,
418            anchor: &NSLayoutYAxisAnchor,
419            multiplier: CGFloat,
420        ) -> Retained<NSLayoutConstraint>;
421
422        #[cfg(all(feature = "NSLayoutConstraint", feature = "objc2-core-foundation"))]
423        #[must_use]
424        #[unsafe(method(constraintLessThanOrEqualToSystemSpacingBelowAnchor:multiplier:))]
425        #[unsafe(method_family = none)]
426        pub fn constraintLessThanOrEqualToSystemSpacingBelowAnchor_multiplier(
427            &self,
428            anchor: &NSLayoutYAxisAnchor,
429            multiplier: CGFloat,
430        ) -> Retained<NSLayoutConstraint>;
431    );
432}