Struct objc2::runtime::Bool [−][src]
#[repr(transparent)]pub struct Bool { /* fields omitted */ }
Expand description
The Objective-C BOOL
type.
This is a thin wrapper-type over objc_sys::BOOL
. It is intended that
you convert this into a Rust bool
with the Bool::is_false
or
Bool::is_true
methods as soon as possible.
This is FFI-safe and can be used in directly with
msg_send!
.
Note that this is able to contain more states than bool
on some
platforms, but these cases should not be relied on!
Example
use objc2::{class, msg_send};
use objc2::runtime::{Object, Bool};
let ns_value: *mut Object = unsafe { msg_send![class!(NSValue), initWithBool: Bool::YES] };
let rtn: Bool = unsafe { msg_send![ns_value, boolValue] };
assert!(rtn.is_true());
Implementations
Creates this from a boolean value received from a raw Objective-C API.
Retrieves the inner objc_sys::BOOL
boolean type, to be used in raw
Objective-C APIs.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Bool
impl UnwindSafe for Bool
Blanket Implementations
Mutably borrows from an owned value. Read more