objc2-media-player 0.3.2

Bindings to the MediaPlayer 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/mediaplayer/mpmediaentitypersistentid?language=objc)
pub type MPMediaEntityPersistentID = u64;

extern "C" {
    /// [Apple's documentation](https://developer.apple.com/documentation/mediaplayer/mpmediaentitypropertypersistentid?language=objc)
    pub static MPMediaEntityPropertyPersistentID: &'static NSString;
}

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

extern_conformance!(
    unsafe impl NSCoding for MPMediaEntity {}
);

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

extern_conformance!(
    unsafe impl NSSecureCoding for MPMediaEntity {}
);

impl MPMediaEntity {
    extern_methods!(
        #[unsafe(method(canFilterByProperty:))]
        #[unsafe(method_family = none)]
        pub unsafe fn canFilterByProperty(property: &NSString) -> bool;

        #[cfg(feature = "block2")]
        #[unsafe(method(enumerateValuesForProperties:usingBlock:))]
        #[unsafe(method_family = none)]
        pub unsafe fn enumerateValuesForProperties_usingBlock(
            &self,
            properties: &NSSet<NSString>,
            block: &block2::DynBlock<dyn Fn(NonNull<NSString>, NonNull<AnyObject>, NonNull<Bool>)>,
        );

        /// # Safety
        ///
        /// `key` should be of the correct type.
        #[unsafe(method(objectForKeyedSubscript:))]
        #[unsafe(method_family = none)]
        pub unsafe fn objectForKeyedSubscript(
            &self,
            key: &AnyObject,
        ) -> Option<Retained<AnyObject>>;

        #[unsafe(method(valueForProperty:))]
        #[unsafe(method_family = none)]
        pub unsafe fn valueForProperty(&self, property: &NSString) -> Option<Retained<AnyObject>>;

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

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