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

Method instance_variable

src/runtime.rs:345–351  ·  view source on GitHub ↗

Returns the ivar for a specified instance variable of self, or `None` if self has no ivar with the given name.

(&self, name: &str)

Source from the content-addressed store, hash-verified

343 /// Returns the ivar for a specified instance variable of self, or `None`
344 /// if self has no ivar with the given name.
345 pub fn instance_variable(&self, name: &str) -> Option<&Ivar> {
346 let name = CString::new(name).unwrap();
347 unsafe {
348 let ivar = class_getInstanceVariable(self, name.as_ptr());
349 if ivar.is_null() { None } else { Some(&*ivar) }
350 }
351 }
352
353 /// Describes the instance methods implemented by self.
354 pub fn instance_methods(&self) -> MallocBuffer<&Method> {

Callers 3

get_ivarMethod · 0.80
get_mut_ivarMethod · 0.80
test_ivarFunction · 0.80

Calls 1

as_ptrMethod · 0.80

Tested by 1

test_ivarFunction · 0.64