MCPcopy Create free account
hub / github.com/SSheldon/rust-objc / get

Method get

src/runtime.rs:278–284  ·  view source on GitHub ↗

Returns the class definition of a specified class, or `None` if the class is not registered with the Objective-C runtime.

(name: &str)

Source from the content-addressed store, hash-verified

276 /// Returns the class definition of a specified class, or `None` if the
277 /// class is not registered with the Objective-C runtime.
278 pub fn get(name: &str) -> Option<&'static Class> {
279 let name = CString::new(name).unwrap();
280 unsafe {
281 let cls = objc_getClass(name.as_ptr());
282 if cls.is_null() { None } else { Some(&*cls) }
283 }
284 }
285
286 /// Obtains the list of registered class definitions.
287 pub fn classes() -> MallocBuffer<&'static Class> {

Callers 4

newMethod · 0.80
loadMethod · 0.80
dropMethod · 0.80
cloneMethod · 0.80

Calls 1

as_ptrMethod · 0.80

Tested by

no test coverage detected