Expand description
struct that holds data for a flag and useful functions
Fields§
§fvec: Vec<bool>Implementations§
source§impl Flag
impl Flag
sourcepub fn add_flag(&mut self, flag: i32, value: bool) -> Result<(), String>
pub fn add_flag(&mut self, flag: i32, value: bool) -> Result<(), String>
add a flag value (if flag already exists returns an Err)
sourcepub fn set_flag(&mut self, flag: i32, value: bool)
pub fn set_flag(&mut self, flag: i32, value: bool)
set a flag value regardless if it exists or not
sourcepub fn get_flag(&self, flag: i32) -> Result<bool, String>
pub fn get_flag(&self, flag: i32) -> Result<bool, String>
get a flags value if it doesn’t exist returns err
sourcepub fn get_all_flags(&self) -> Vec<i32>
pub fn get_all_flags(&self) -> Vec<i32>
returns a vector with all enabled flags
sourcepub fn pad(&mut self, len: i32) -> Result<(), i32>
pub fn pad(&mut self, len: i32) -> Result<(), i32>
extends the Vec
sourcepub fn new_from_existing(value: i32) -> Self
pub fn new_from_existing(value: i32) -> Self
creates Flag from int