Trait EngineBitfield

Source
pub trait EngineBitfield: Copy {
    // Required methods
    fn try_from_ord(ord: u64) -> Option<Self>;
    fn ord(self) -> u64;
    fn all_constants() -> &'static [EnumConstant<Self>];

    // Provided methods
    fn from_ord(ord: u64) -> Self { ... }
    fn is_set(self, flag: Self) -> bool { ... }
}
Expand description

Auto-implemented for all engine-provided bitfields.

Required Methods§

Source

fn try_from_ord(ord: u64) -> Option<Self>

Source

fn ord(self) -> u64

Ordinal value of the bit flag, as specified in Godot.

Source

fn all_constants() -> &'static [EnumConstant<Self>]

Returns metadata for all bitfield constants.

This includes all constants as they appear in the bitfield definition.

Enables introspection of available constants:

use godot::global::KeyModifierMask;
use godot::obj::EngineBitfield;

for constant in KeyModifierMask::all_constants() {
    println!("* KeyModifierMask.{} (original {}) has ordinal value {}.",
        constant.rust_name(),
        constant.godot_name(),
        constant.value().ord()
    );
}

Provided Methods§

Source

fn from_ord(ord: u64) -> Self

Source

fn is_set(self, flag: Self) -> bool

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§