veeso / ssh2-config

a ssh config parser for ssh2-rs
MIT License
10 stars 8 forks source link

[QUESTION] - TITLE #4

Closed dev-ardi closed 1 year ago

dev-ardi commented 1 year ago
bitflags! {
    /// The parsing mode
    #[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
    pub struct ParseRule: u8 {
        /// Don't allow any invalid field or value
        const STRICT = 0b00000000;
        /// Allow unknown field
        const ALLOW_UNKNOWN_FIELDS = 0b00000001;
    }
}

Why didn't you just use an enum?

veeso commented 1 year ago

because it is meant to become non-exclusive rules in the possible future.

dev-ardi commented 1 year ago

In that case you could use a packed struct of enums, bitfields are an old C pattern, and enums are more ergonomic in Rust.