objc2_foundation/generated/
NSDateInterval.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
6use crate::*;
7
8extern_class!(
9    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsdateinterval?language=objc)
10    #[unsafe(super(NSObject))]
11    #[derive(Debug, PartialEq, Eq, Hash)]
12    pub struct NSDateInterval;
13);
14
15unsafe impl Send for NSDateInterval {}
16
17unsafe impl Sync for NSDateInterval {}
18
19#[cfg(feature = "NSObject")]
20extern_conformance!(
21    unsafe impl NSCoding for NSDateInterval {}
22);
23
24#[cfg(feature = "NSObject")]
25extern_conformance!(
26    unsafe impl NSCopying for NSDateInterval {}
27);
28
29#[cfg(feature = "NSObject")]
30unsafe impl CopyingHelper for NSDateInterval {
31    type Result = Self;
32}
33
34extern_conformance!(
35    unsafe impl NSObjectProtocol for NSDateInterval {}
36);
37
38#[cfg(feature = "NSObject")]
39extern_conformance!(
40    unsafe impl NSSecureCoding for NSDateInterval {}
41);
42
43impl NSDateInterval {
44    extern_methods!(
45        #[cfg(feature = "NSDate")]
46        #[unsafe(method(startDate))]
47        #[unsafe(method_family = none)]
48        pub fn startDate(&self) -> Retained<NSDate>;
49
50        #[cfg(feature = "NSDate")]
51        #[unsafe(method(endDate))]
52        #[unsafe(method_family = none)]
53        pub fn endDate(&self) -> Retained<NSDate>;
54
55        #[cfg(feature = "NSDate")]
56        #[unsafe(method(duration))]
57        #[unsafe(method_family = none)]
58        pub fn duration(&self) -> NSTimeInterval;
59
60        #[unsafe(method(init))]
61        #[unsafe(method_family = init)]
62        pub fn init(this: Allocated<Self>) -> Retained<Self>;
63
64        #[cfg(feature = "NSCoder")]
65        /// # Safety
66        ///
67        /// `coder` possibly has further requirements.
68        #[unsafe(method(initWithCoder:))]
69        #[unsafe(method_family = init)]
70        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;
71
72        #[cfg(feature = "NSDate")]
73        #[unsafe(method(initWithStartDate:duration:))]
74        #[unsafe(method_family = init)]
75        pub fn initWithStartDate_duration(
76            this: Allocated<Self>,
77            start_date: &NSDate,
78            duration: NSTimeInterval,
79        ) -> Retained<Self>;
80
81        #[cfg(feature = "NSDate")]
82        #[unsafe(method(initWithStartDate:endDate:))]
83        #[unsafe(method_family = init)]
84        pub fn initWithStartDate_endDate(
85            this: Allocated<Self>,
86            start_date: &NSDate,
87            end_date: &NSDate,
88        ) -> Retained<Self>;
89
90        #[cfg(feature = "NSObjCRuntime")]
91        #[unsafe(method(compare:))]
92        #[unsafe(method_family = none)]
93        pub fn compare(&self, date_interval: &NSDateInterval) -> NSComparisonResult;
94
95        #[unsafe(method(isEqualToDateInterval:))]
96        #[unsafe(method_family = none)]
97        pub fn isEqualToDateInterval(&self, date_interval: &NSDateInterval) -> bool;
98
99        #[unsafe(method(intersectsDateInterval:))]
100        #[unsafe(method_family = none)]
101        pub fn intersectsDateInterval(&self, date_interval: &NSDateInterval) -> bool;
102
103        #[unsafe(method(intersectionWithDateInterval:))]
104        #[unsafe(method_family = none)]
105        pub fn intersectionWithDateInterval(
106            &self,
107            date_interval: &NSDateInterval,
108        ) -> Option<Retained<NSDateInterval>>;
109
110        #[cfg(feature = "NSDate")]
111        #[unsafe(method(containsDate:))]
112        #[unsafe(method_family = none)]
113        pub fn containsDate(&self, date: &NSDate) -> bool;
114    );
115}
116
117/// Methods declared on superclass `NSObject`.
118impl NSDateInterval {
119    extern_methods!(
120        #[unsafe(method(new))]
121        #[unsafe(method_family = new)]
122        pub fn new() -> Retained<Self>;
123    );
124}
125
126impl DefaultRetained for NSDateInterval {
127    #[inline]
128    fn default_retained() -> Retained<Self> {
129        Self::new()
130    }
131}