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::*;

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

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

impl NSMappingModel {
    extern_methods!(
        #[cfg(feature = "NSManagedObjectModel")]
        #[unsafe(method(mappingModelFromBundles:forSourceModel:destinationModel:))]
        #[unsafe(method_family = none)]
        pub unsafe fn mappingModelFromBundles_forSourceModel_destinationModel(
            bundles: Option<&NSArray<NSBundle>>,
            source_model: Option<&NSManagedObjectModel>,
            destination_model: Option<&NSManagedObjectModel>,
        ) -> Option<Retained<NSMappingModel>>;

        #[cfg(feature = "NSManagedObjectModel")]
        #[unsafe(method(inferredMappingModelForSourceModel:destinationModel:error:_))]
        #[unsafe(method_family = none)]
        pub unsafe fn inferredMappingModelForSourceModel_destinationModel_error(
            source_model: &NSManagedObjectModel,
            destination_model: &NSManagedObjectModel,
        ) -> Result<Retained<NSMappingModel>, Retained<NSError>>;

        #[unsafe(method(initWithContentsOfURL:))]
        #[unsafe(method_family = init)]
        pub unsafe fn initWithContentsOfURL(
            this: Allocated<Self>,
            url: Option<&NSURL>,
        ) -> Option<Retained<Self>>;

        #[cfg(feature = "NSEntityMapping")]
        #[unsafe(method(entityMappings))]
        #[unsafe(method_family = none)]
        pub unsafe fn entityMappings(&self) -> Option<Retained<NSArray<NSEntityMapping>>>;

        #[cfg(feature = "NSEntityMapping")]
        /// Setter for [`entityMappings`][Self::entityMappings].
        ///
        /// # Safety
        ///
        /// `entity_mappings` might not allow `None`.
        #[unsafe(method(setEntityMappings:))]
        #[unsafe(method_family = none)]
        pub unsafe fn setEntityMappings(&self, entity_mappings: Option<&NSArray<NSEntityMapping>>);

        #[cfg(feature = "NSEntityMapping")]
        #[unsafe(method(entityMappingsByName))]
        #[unsafe(method_family = none)]
        pub unsafe fn entityMappingsByName(
            &self,
        ) -> Retained<NSDictionary<NSString, NSEntityMapping>>;
    );
}

/// Methods declared on superclass `NSObject`.
impl NSMappingModel {
    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>;
    );
}