Struct objc2::declare::ProtocolBuilder
source · pub struct ProtocolBuilder { /* private fields */ }
Expand description
A type for declaring a new protocol and adding new methods to it before registering it.
Implementations§
source§impl ProtocolBuilder
impl ProtocolBuilder
sourcepub fn new(name: &str) -> Option<Self>
pub fn new(name: &str) -> Option<Self>
Constructs a ProtocolBuilder
with the given name.
Returns None
if the protocol couldn’t be allocated.
sourcepub fn add_method_description<Args, Ret>(&mut self, sel: Sel, is_required: bool)where
Args: EncodeArguments,
Ret: Encode,
pub fn add_method_description<Args, Ret>(&mut self, sel: Sel, is_required: bool)where Args: EncodeArguments, Ret: Encode,
Adds an instance method declaration with a given description.
sourcepub fn add_class_method_description<Args, Ret>(
&mut self,
sel: Sel,
is_required: bool
)where
Args: EncodeArguments,
Ret: Encode,
pub fn add_class_method_description<Args, Ret>( &mut self, sel: Sel, is_required: bool )where Args: EncodeArguments, Ret: Encode,
Adds a class method declaration with a given description.
sourcepub fn add_protocol(&mut self, proto: &Protocol)
pub fn add_protocol(&mut self, proto: &Protocol)
Adds a requirement on another protocol.
sourcepub fn register(self) -> &'static Protocol
pub fn register(self) -> &'static Protocol
Registers the ProtocolBuilder
, consuming it and returning a reference
to the newly registered Protocol
.
Trait Implementations§
source§impl Debug for ProtocolBuilder
impl Debug for ProtocolBuilder
impl Send for ProtocolBuilder
impl Sync for ProtocolBuilder
Auto Trait Implementations§
impl RefUnwindSafe for ProtocolBuilder
impl Unpin for ProtocolBuilder
impl UnwindSafe for ProtocolBuilder
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more