Skip to main content

send_ret_ptr

Function send_ret_ptr 

Source
pub unsafe fn send_ret_ptr(recv: *mut c_void, s: *const c_void) -> *const u8
Expand description

Send a message with a specific, non-variadic signature.

§Safety

recv must be a live Objective-C object that responds to s, and the declared argument and return types must match that selector’s. Nothing here checks either.

Examples found in repository?
examples/scenes.rs (line 213)
209    unsafe fn text(ns: *mut c_void) -> String {
210        if ns.is_null() {
211            return String::new();
212        }
213        let p = unsafe { objc::send_ret_ptr(ns, objc::sel(c"UTF8String")) };
214        if p.is_null() {
215            return String::new();
216        }
217        unsafe { core::ffi::CStr::from_ptr(p as *const core::ffi::c_char) }
218            .to_string_lossy()
219            .into_owned()
220    }