objc2_foundation/generated/
NSInvocation.rs

1//! This file has been automatically generated by `objc2`'s `header-translator`.
2//! DO NOT EDIT
3use core::ffi::*;
4use core::ptr::NonNull;
5use objc2::__framework_prelude::*;
6
7use crate::*;
8
9extern_class!(
10    /// [Apple's documentation](https://developer.apple.com/documentation/foundation/nsinvocation?language=objc)
11    #[unsafe(super(NSObject))]
12    #[derive(Debug, PartialEq, Eq, Hash)]
13    pub struct NSInvocation;
14);
15
16extern_conformance!(
17    unsafe impl NSObjectProtocol for NSInvocation {}
18);
19
20impl NSInvocation {
21    extern_methods!(
22        #[cfg(feature = "NSMethodSignature")]
23        #[unsafe(method(invocationWithMethodSignature:))]
24        #[unsafe(method_family = none)]
25        pub unsafe fn invocationWithMethodSignature(
26            sig: &NSMethodSignature,
27        ) -> Retained<NSInvocation>;
28
29        #[cfg(feature = "NSMethodSignature")]
30        #[unsafe(method(methodSignature))]
31        #[unsafe(method_family = none)]
32        pub unsafe fn methodSignature(&self) -> Retained<NSMethodSignature>;
33
34        #[unsafe(method(retainArguments))]
35        #[unsafe(method_family = none)]
36        pub unsafe fn retainArguments(&self);
37
38        #[unsafe(method(argumentsRetained))]
39        #[unsafe(method_family = none)]
40        pub unsafe fn argumentsRetained(&self) -> bool;
41
42        /// # Safety
43        ///
44        /// This is not retained internally, you must ensure the object is still alive.
45        #[unsafe(method(target))]
46        #[unsafe(method_family = none)]
47        pub unsafe fn target(&self) -> Option<Retained<AnyObject>>;
48
49        /// Setter for [`target`][Self::target].
50        ///
51        /// # Safety
52        ///
53        /// - `target` should be of the correct type.
54        /// - This is unretained, you must ensure the object is kept alive while in use.
55        #[unsafe(method(setTarget:))]
56        #[unsafe(method_family = none)]
57        pub unsafe fn setTarget(&self, target: Option<&AnyObject>);
58
59        #[unsafe(method(selector))]
60        #[unsafe(method_family = none)]
61        pub unsafe fn selector(&self) -> Sel;
62
63        /// Setter for [`selector`][Self::selector].
64        ///
65        /// # Safety
66        ///
67        /// `selector` must be a valid selector.
68        #[unsafe(method(setSelector:))]
69        #[unsafe(method_family = none)]
70        pub unsafe fn setSelector(&self, selector: Sel);
71
72        /// # Safety
73        ///
74        /// `ret_loc` must be a valid pointer.
75        #[unsafe(method(getReturnValue:))]
76        #[unsafe(method_family = none)]
77        pub unsafe fn getReturnValue(&self, ret_loc: NonNull<c_void>);
78
79        /// # Safety
80        ///
81        /// `ret_loc` must be a valid pointer.
82        #[unsafe(method(setReturnValue:))]
83        #[unsafe(method_family = none)]
84        pub unsafe fn setReturnValue(&self, ret_loc: NonNull<c_void>);
85
86        /// # Safety
87        ///
88        /// `argument_location` must be a valid pointer.
89        #[unsafe(method(getArgument:atIndex:))]
90        #[unsafe(method_family = none)]
91        pub unsafe fn getArgument_atIndex(
92            &self,
93            argument_location: NonNull<c_void>,
94            idx: NSInteger,
95        );
96
97        /// # Safety
98        ///
99        /// `argument_location` must be a valid pointer.
100        #[unsafe(method(setArgument:atIndex:))]
101        #[unsafe(method_family = none)]
102        pub unsafe fn setArgument_atIndex(
103            &self,
104            argument_location: NonNull<c_void>,
105            idx: NSInteger,
106        );
107
108        #[unsafe(method(invoke))]
109        #[unsafe(method_family = none)]
110        pub unsafe fn invoke(&self);
111
112        /// # Safety
113        ///
114        /// `target` should be of the correct type.
115        #[unsafe(method(invokeWithTarget:))]
116        #[unsafe(method_family = none)]
117        pub unsafe fn invokeWithTarget(&self, target: &AnyObject);
118
119        /// # Safety
120        ///
121        /// `imp` must be a valid IMP.
122        #[unsafe(method(invokeUsingIMP:))]
123        #[unsafe(method_family = none)]
124        pub unsafe fn invokeUsingIMP(&self, imp: Option<Imp>);
125    );
126}
127
128/// Methods declared on superclass `NSObject`.
129impl NSInvocation {
130    extern_methods!(
131        #[unsafe(method(init))]
132        #[unsafe(method_family = init)]
133        pub unsafe fn init(this: Allocated<Self>) -> Retained<Self>;
134
135        #[unsafe(method(new))]
136        #[unsafe(method_family = new)]
137        pub unsafe fn new() -> Retained<Self>;
138    );
139}