Skip to content

Subset of Add for use with booleans? #501

@dolezvo1

Description

@dolezvo1

Hi, I was hoping I would be able to generate bitwise operations for my struct, but I noticed that it doesn't appear to be possible to use Add for structs with booleans. Of course bool doesn't implement Add or Sub, so perhaps it could be possible to have a subset of bitwise traits?

#[derive(Bitwise)]
struct Flags {
    flag_one: bool,
    flag_two: bool,
}

let a: Flags = Flags { flag_one: true, flag_two: false };
let b: Flags = Flags { flag_one: false, flag_two: true };
let c = a | b;
let d = a ^ b;
let e = a & b;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions