Download rust/crates/hyperkitty-continuity/src/environment.rs from Snapkitty/hyperkitty-constraint-dsl: direct link, hf CLI and curl.
- Browser
- Download file 681 Bytes
-
https://huggingface.co/Snapkitty/hyperkitty-constraint-dsl/resolve/main/rust/crates/hyperkitty-continuity/src/environment.rs
- Command line
-
hf download hf://Snapkitty/hyperkitty-constraint-dsl/rust/crates/hyperkitty-continuity/src/environment.rs
-
curl -L -o environment.rs https://huggingface.co/Snapkitty/hyperkitty-constraint-dsl/resolve/main/rust/crates/hyperkitty-continuity/src/environment.rs
681 Bytes
| pub struct EnvironmentBitmask { | |
| pub mask: u64, | |
| pub env_var_name: String, | |
| } | |
| impl EnvironmentBitmask { | |
| pub fn new(var_name: &str) -> Self { | |
| Self { | |
| mask: 0, | |
| env_var_name: var_name.to_string(), | |
| } | |
| } | |
| pub fn set_bit(&mut self, position: u8, value: bool) { | |
| if position < 64 { | |
| if value { | |
| self.mask |= 1 << position; | |
| } else { | |
| self.mask &= !(1 << position); | |
| } | |
| } | |
| } | |
| pub fn get_bit(&self, position: u8) -> bool { | |
| if position < 64 { | |
| (self.mask & (1 << position)) != 0 | |
| } else { | |
| false | |
| } | |
| } | |
| } | |