objc2-foundation 0.3.2

Bindings to the Foundation 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 crate::*;

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

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

impl NSMethodSignature {
    extern_methods!(
        /// # Safety
        ///
        /// `types` must be a valid pointer.
        #[unsafe(method(signatureWithObjCTypes:))]
        #[unsafe(method_family = none)]
        pub unsafe fn signatureWithObjCTypes(
            types: NonNull<c_char>,
        ) -> Option<Retained<NSMethodSignature>>;

        #[unsafe(method(numberOfArguments))]
        #[unsafe(method_family = none)]
        pub fn numberOfArguments(&self) -> NSUInteger;

        #[unsafe(method(getArgumentTypeAtIndex:))]
        #[unsafe(method_family = none)]
        pub fn getArgumentTypeAtIndex(&self, idx: NSUInteger) -> NonNull<c_char>;

        #[unsafe(method(frameLength))]
        #[unsafe(method_family = none)]
        pub fn frameLength(&self) -> NSUInteger;

        #[unsafe(method(isOneway))]
        #[unsafe(method_family = none)]
        pub fn isOneway(&self) -> bool;

        #[unsafe(method(methodReturnType))]
        #[unsafe(method_family = none)]
        pub fn methodReturnType(&self) -> NonNull<c_char>;

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

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

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

impl DefaultRetained for NSMethodSignature {
    #[inline]
    fn default_retained() -> Retained<Self> {
        Self::new()
    }
}