docs

v0.1.2 문서를 보고 있습니다. 이 버전은 더 이상 지원하지 않습니다. 최신 릴리스: v0.1.3 →

bare::ffi::objc::subclass

이 페이지의 내용

API 참조는 영어로만 있습니다. 표준 라이브러리 소스의 영어 문서 주석에서 만듭니다.

classes made at run time (objc_allocateClassPair): Nabi functions as an Objective-C class's methods, for delegates and the classes an API wants subclassed.

A method's implementation is an extern "C" fn(this: CPtr<u8>, cmd: Sel, ..) with the arguments its selector takes; types is its Objective-C type encoding ("v@:@": returns void, takes self, _cmd and an object).

Structs

ClassBuilderSource

pub struct ClassBuilder

A class being made: add its methods and protocols, then register.

  • pub fn new(name: str, sup: Class) -> ClassBuilder | none§

    Source

    A new class name whose superclass is sup; none when a class of that name exists.

  • pub unsafe fn method(self, sel: Sel, imp: usize, types: str) -> ClassBuilder§

    Source

    Method sel running imp, the address of an extern "C" fn taking the receiver, the selector and sel's arguments, of type encoding types. A method of the superclass it overrides must have its signature.

    Safety: imp is such a function, and types says its signature.

  • pub fn protocol(self, name: str) -> ClassBuilder§

    Source

    Conform to protocol name (NSApplicationDelegate), which a linked framework declares.

  • pub fn register(self) -> Class§

    Source

    Register the class with the runtime; its class object, whose alloc/new make instances.