objc2_event_kit/generated/EKRecurrenceEnd.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::*;
5use objc2_foundation::*;
6
7use crate::*;
8
9extern_class!(
10 /// Class which represents when a recurrence should end.
11 ///
12 /// EKRecurrenceEnd is an attribute of EKRecurrenceRule that defines how long
13 /// the recurrence is scheduled to repeat. The recurrence can be defined either
14 /// with an NSUInteger that indicates the total number times it repeats, or with
15 /// an NSDate, after which it no longer repeats. An event which is set to never
16 /// end should have its EKRecurrenceEnd set to nil.
17 ///
18 /// If the end of the pattern is defines with an NSDate, the client must pass a
19 /// valid NSDate, nil cannot be passed. If the end of the pattern is defined as
20 /// terms of a number of occurrences, the occurrenceCount passed to the initializer
21 /// must be positive, it cannot be 0. If the client attempts to initialize a
22 /// EKRecurrenceEnd with a nil NSDate or OccurrenceCount of 0, an exception is raised.
23 ///
24 /// A EKRecurrenceEnd initialized with an end date will return 0 for occurrenceCount.
25 /// One initialized with a number of occurrences will return nil for its endDate.
26 ///
27 /// See also [Apple's documentation](https://developer.apple.com/documentation/eventkit/ekrecurrenceend?language=objc)
28 #[unsafe(super(NSObject))]
29 #[derive(Debug, PartialEq, Eq, Hash)]
30 pub struct EKRecurrenceEnd;
31);
32
33unsafe impl NSCoding for EKRecurrenceEnd {}
34
35unsafe impl NSCopying for EKRecurrenceEnd {}
36
37unsafe impl CopyingHelper for EKRecurrenceEnd {
38 type Result = Self;
39}
40
41unsafe impl NSObjectProtocol for EKRecurrenceEnd {}
42
43unsafe impl NSSecureCoding for EKRecurrenceEnd {}
44
45impl EKRecurrenceEnd {
46 extern_methods!(
47 /// Creates an autoreleased recurrence end with a specific end date.
48 #[unsafe(method(recurrenceEndWithEndDate:))]
49 #[unsafe(method_family = none)]
50 pub unsafe fn recurrenceEndWithEndDate(end_date: &NSDate) -> Retained<Self>;
51
52 /// Creates an autoreleased recurrence end with a maximum occurrence count.
53 #[unsafe(method(recurrenceEndWithOccurrenceCount:))]
54 #[unsafe(method_family = none)]
55 pub unsafe fn recurrenceEndWithOccurrenceCount(
56 occurrence_count: NSUInteger,
57 ) -> Retained<Self>;
58
59 /// The end date of this recurrence, or nil if it's count-based.
60 #[unsafe(method(endDate))]
61 #[unsafe(method_family = none)]
62 pub unsafe fn endDate(&self) -> Option<Retained<NSDate>>;
63
64 /// The maximum occurrence count, or 0 if it's date-based.
65 #[unsafe(method(occurrenceCount))]
66 #[unsafe(method_family = none)]
67 pub unsafe fn occurrenceCount(&self) -> NSUInteger;
68 );
69}
70
71/// Methods declared on superclass `NSObject`.
72impl EKRecurrenceEnd {
73 extern_methods!(
74 #[unsafe(method(init))]
75 #[unsafe(method_family = init)]
76 pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
77
78 #[unsafe(method(new))]
79 #[unsafe(method_family = new)]
80 pub unsafe fn new() -> Retained<Self>;
81 );
82}