OpenCVBitfieldEnum

Trait OpenCVBitfieldEnum 

Source
pub trait OpenCVBitfieldEnum:
    Sized
    + Copy
    + 'static {
    const ALL_FLAGS: &'static [Self];

    // Required methods
    unsafe fn from_i32_unchecked(value: i32) -> Self;
    fn to_i32(self) -> i32;

    // Provided methods
    fn try_from_i32(value: i32) -> Result<Self> { ... }
    fn is_set(self, flag: Self) -> bool { ... }
    fn set(&mut self, flag: Self) { ... }
    fn clear(&mut self, flag: Self) { ... }
    fn toggle(&mut self, flag: Self) { ... }
    fn with(self, flags: Self) -> Self { ... }
    fn without(self, flags: Self) -> Self { ... }
}
Expand description

Common trait for all enums that represent flags, e.g. can be combined using bitwise operations

Required Associated Constants§

Source

const ALL_FLAGS: &'static [Self]

List of all valid separate flags for this enum, mostly for internal use

Required Methods§

Source

unsafe fn from_i32_unchecked(value: i32) -> Self

Construct the enum from an i32 value without checking its validity

§Safety

The caller must ensure that value is a valid combination of flags defined in Self::ALL_FLAGS.

Source

fn to_i32(self) -> i32

Get the i32 value of this enum

Provided Methods§

Source

fn try_from_i32(value: i32) -> Result<Self>

Construct the enum from an i32 value, returning an error if any of the set bits do not have associated flags

Source

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

Check whether the specified flag or flags are set

Source

fn set(&mut self, flag: Self)

Set the specified flag or flags

If the specified flag has 0 value, then it replaces the current value completely as it’s the only way to “set” 0-value flag.

Source

fn clear(&mut self, flag: Self)

Clear the specified flag or flags

If the specified flag has 0 value, then it does nothing.

Source

fn toggle(&mut self, flag: Self)

Toggle the specified flag or flags

Source

fn with(self, flags: Self) -> Self

Return a new value with the specified flag or flags set in addition to the current ones

Source

fn without(self, flags: Self) -> Self

Return a new value with the specified flag or flags cleared from the current ones

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§

Source§

impl OpenCVBitfieldEnum for CovarFlags

Source§

const ALL_FLAGS: &'static [Self]

Source§

impl OpenCVBitfieldEnum for DftFlags

Source§

const ALL_FLAGS: &'static [Self]

Source§

impl OpenCVBitfieldEnum for Event_CreateFlags

Source§

const ALL_FLAGS: &'static [Self]

Source§

impl OpenCVBitfieldEnum for FLAGS

Source§

const ALL_FLAGS: &'static [Self]

Source§

impl OpenCVBitfieldEnum for GemmFlags

Source§

const ALL_FLAGS: &'static [Self]

Source§

impl OpenCVBitfieldEnum for KmeansFlags

Source§

const ALL_FLAGS: &'static [Self]

Source§

impl OpenCVBitfieldEnum for PCA_Flags

Source§

const ALL_FLAGS: &'static [Self]

Source§

impl OpenCVBitfieldEnum for SVD_Flags

Source§

const ALL_FLAGS: &'static [Self]

Source§

impl OpenCVBitfieldEnum for SortFlags

Source§

const ALL_FLAGS: &'static [Self]

Source§

impl OpenCVBitfieldEnum for DrawMatchesFlags

Source§

const ALL_FLAGS: &'static [Self]

Source§

impl OpenCVBitfieldEnum for MouseEventFlags

Source§

const ALL_FLAGS: &'static [Self]

Source§

impl OpenCVBitfieldEnum for WindowFlags

Source§

const ALL_FLAGS: &'static [Self]

Source§

impl OpenCVBitfieldEnum for FloodFillFlags

Source§

const ALL_FLAGS: &'static [Self]

Source§

impl OpenCVBitfieldEnum for DrawLinesMatchesFlags

Source§

const ALL_FLAGS: &'static [Self]

Source§

impl OpenCVBitfieldEnum for ANN_MLP_TrainFlags

Source§

const ALL_FLAGS: &'static [Self]

Source§

impl OpenCVBitfieldEnum for StatModel_Flags

Source§

const ALL_FLAGS: &'static [Self]

Source§

impl OpenCVBitfieldEnum for SceneSettings

Source§

const ALL_FLAGS: &'static [Self]