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

The equivalent of true for Objective-C’s BOOL type.

The equivalent of false for Objective-C’s BOOL type.

Creates an Objective-C boolean from a Rust boolean.

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.

Returns true if self is NO.

Returns true if self is the opposite of NO.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

The Objective-C type-encoding for this type.

Performs the conversion.

Performs the conversion.

The Objective-C type-encoding for a reference of this type. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.