objc2-foundation 0.3.1

Bindings to the Foundation framework
Documentation
//! This file has been automatically generated by `objc2`'s `header-translator`.
//! DO NOT EDIT
use core::ptr::NonNull;
use objc2::__framework_prelude::*;

use crate::*;

extern_class!(
    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsdateinterval?language=objc)
    #[unsafe(super(NSObject))]
    #[derive(Debug, PartialEq, Eq, Hash)]
    pub struct NSDateInterval;
);

unsafe impl Send for NSDateInterval {}

unsafe impl Sync for NSDateInterval {}

#[cfg(feature = "NSObject")]
extern_conformance!(
    unsafe impl NSCoding for NSDateInterval {}
);

#[cfg(feature = "NSObject")]
extern_conformance!(
    unsafe impl NSCopying for NSDateInterval {}
);

#[cfg(feature = "NSObject")]
unsafe impl CopyingHelper for NSDateInterval {
    type Result = Self;
}

extern_conformance!(
    unsafe impl NSObjectProtocol for NSDateInterval {}
);

#[cfg(feature = "NSObject")]
extern_conformance!(
    unsafe impl NSSecureCoding for NSDateInterval {}
);

impl NSDateInterval {
    extern_methods!(
        #[cfg(feature = "NSDate")]
        #[unsafe(method(startDate))]
        #[unsafe(method_family = none)]
        pub unsafe fn startDate(&self) -> Retained<NSDate>;

        #[cfg(feature = "NSDate")]
        #[unsafe(method(endDate))]
        #[unsafe(method_family = none)]
        pub unsafe fn endDate(&self) -> Retained<NSDate>;

        #[cfg(feature = "NSDate")]
        #[unsafe(method(duration))]
        #[unsafe(method_family = none)]
        pub unsafe fn duration(&self) -> NSTimeInterval;

        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[cfg(feature = "NSCoder")]
        #[unsafe(method(initWithCoder:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithCoder(this: Allocated<Self>, coder: &NSCoder) -> Retained<Self>;

        #[cfg(feature = "NSDate")]
        #[unsafe(method(initWithStartDate:duration:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithStartDate_duration(
            this: Allocated<Self>,
            start_date: &NSDate,
            duration: NSTimeInterval,
        ) -> Retained<Self>;

        #[cfg(feature = "NSDate")]
        #[unsafe(method(initWithStartDate:endDate:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithStartDate_endDate(
            this: Allocated<Self>,
            start_date: &NSDate,
            end_date: &NSDate,
        ) -> Retained<Self>;

        #[cfg(feature = "NSObjCRuntime")]
        #[unsafe(method(compare:))]
        #[unsafe(method_family = none)]
        pub unsafe fn compare(&self, date_interval: &NSDateInterval) -> NSComparisonResult;

        #[unsafe(method(isEqualToDateInterval:))]
        #[unsafe(method_family = none)]
        pub unsafe fn isEqualToDateInterval(&self, date_interval: &NSDateInterval) -> bool;

        #[unsafe(method(intersectsDateInterval:))]
        #[unsafe(method_family = none)]
        pub unsafe fn intersectsDateInterval(&self, date_interval: &NSDateInterval) -> bool;

        #[unsafe(method(intersectionWithDateInterval:))]
        #[unsafe(method_family = none)]
        pub unsafe fn intersectionWithDateInterval(
            &self,
            date_interval: &NSDateInterval,
        ) -> Option<Retained<NSDateInterval>>;

        #[cfg(feature = "NSDate")]
        #[unsafe(method(containsDate:))]
        #[unsafe(method_family = none)]
        pub unsafe fn containsDate(&self, date: &NSDate) -> bool;
    );
}

/// Methods declared on superclass `NSObject`.
impl NSDateInterval {
    extern_methods!(
        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}