#[repr(C)]
pub struct Boolean(_);
Expand description

Boolean Type

This boolean type works very similar to the rust primitive type of bool. However, the rust primitive type has no stable ABI, hence we provide this type to represent booleans on the FFI interface.

UEFI defines booleans to be 1-byte integers, which can only have the values of 0 or 1. However, in practice anything non-zero is considered true by nearly all UEFI systems. Hence, this type implements a boolean over u8 and maps 0 to false, everything else to true.

The binary representation of this type is ABI. That is, you are allowed to transmute from and to u8. Furthermore, this type never modifies its binary representation. If it was initialized as, or transmuted from, a specific integer value, this value will be retained. However, on the rust side you will never see the integer value. It instead behaves truly as a boolean. If you need access to the integer value, you have to transmute it back to u8.

Implementations

Literal False

This constant represents the false value of the Boolean type.

Literal True

This constant represents the true value of the Boolean type.

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

Converts to this type from the input type.

Converts to this type from the input type.

Converts to this type from the input type.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. 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

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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.