objc2-core-data 0.3.2

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

use crate::*;

/// [Apple's documentation](https://developer.apple.com/documentation/coredata/nspersistentstorerequesttype?language=objc)
// NS_ENUM
#[repr(transparent)]
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
pub struct NSPersistentStoreRequestType(pub NSUInteger);
impl NSPersistentStoreRequestType {
    #[doc(alias = "NSFetchRequestType")]
    pub const FetchRequestType: Self = Self(1);
    #[doc(alias = "NSSaveRequestType")]
    pub const SaveRequestType: Self = Self(2);
    #[doc(alias = "NSBatchInsertRequestType")]
    pub const BatchInsertRequestType: Self = Self(5);
    #[doc(alias = "NSBatchUpdateRequestType")]
    pub const BatchUpdateRequestType: Self = Self(6);
    #[doc(alias = "NSBatchDeleteRequestType")]
    pub const BatchDeleteRequestType: Self = Self(7);
}

unsafe impl Encode for NSPersistentStoreRequestType {
    const ENCODING: Encoding = NSUInteger::ENCODING;
}

unsafe impl RefEncode for NSPersistentStoreRequestType {
    const ENCODING_REF: Encoding = Encoding::Pointer(&Self::ENCODING);
}

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

extern_conformance!(
    unsafe impl NSCopying for NSPersistentStoreRequest {}
);

unsafe impl CopyingHelper for NSPersistentStoreRequest {
    type Result = Self;
}

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

impl NSPersistentStoreRequest {
    extern_methods!(
        #[cfg(feature = "NSPersistentStore")]
        #[unsafe(method(affectedStores))]
        #[unsafe(method_family = none)]
        pub unsafe fn affectedStores(&self) -> Option<Retained<NSArray<NSPersistentStore>>>;

        #[cfg(feature = "NSPersistentStore")]
        /// Setter for [`affectedStores`][Self::affectedStores].
        #[unsafe(method(setAffectedStores:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setAffectedStores(
            &self,
            affected_stores: Option<&NSArray<NSPersistentStore>>,
        );

        #[unsafe(method(requestType))]
        #[unsafe(method_family = none)]
        pub unsafe fn requestType(&self) -> NSPersistentStoreRequestType;
    );
}

/// Methods declared on superclass `NSObject`.
impl NSPersistentStoreRequest {
    extern_methods!(
        #[unsafe(method(init))]
        #[unsafe(method_family = init)]
        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;

        #[unsafe(method(new))]
        #[unsafe(method_family = new)]
        pub unsafe fn new() -> Retained<Self>;
    );
}