pub fn retrieve_configuration(path: &str) -> Vec<AlarmConfig> {
    let mut buff: Vec<AlarmConfig> = Vec::new();

    match OpenOptions::new().truncate(false).read(true).open(path) {
        Ok(ref mut file) => {
            use std::io::Read;

            let mut buff_str = String::new();
            let read_result = file.read_to_string(&mut buff_str);

            match read_result {
                Ok(_) => {

                    let parsed = buff_str
                        .lines()
                        .flat_map(|line| parse_configuration(&line))
                        .collect::<Vec<_>>();

                    buff.extend(parsed.iter().cloned());
                },
                Err(err) => { panic!("Unable to read file: {}", err); }
            }
        },
        Err(err) => { panic!("Failed to open configuration file: {}", err); }
    }

    buff
}
/// Retrieve the configuration from a configuration file
Retrieve the configuration from a configuration file
Retrieve the configuration from a configuration file
pub fn retrieve_configuration(path: &str) -> Vec<AlarmConfig> {
    let mut buff: Vec<AlarmConfig> = Vec::new();
    match OpenOptions::new().truncate(false).read(true).open(path) {
        Ok(ref mut file) => {
            use std::io::Read;
            let mut buff_str = String::new();
            let read_result = file.read_to_string(&mut buff_str);
            match read_result {
                Ok(_) => {
                    let parsed = buff_str
                        .lines()
                        .flat_map(|line| parse_configuration(&line))
                        .collect::<Vec<_>>();
                    buff.extend(parsed.iter().cloned());
                },
                Err(err) => { panic!("Unable to read file: {}", err); }
            }
        },
        Err(err) => { panic!("Failed to open configuration file: {}", err); }
    }
    buff
}
pub fn retrieve_configuration ( path : & str ) -> Vec < AlarmConfig > { let mut buff : Vec < AlarmConfig > = Vec :: new ( ) ; match OpenOptions :: new ( ) . truncate ( false ) . read ( true ) . open ( path ) { Ok ( ref mut file ) => { use std :: io :: Read ; let mut buff_str = String :: new ( ) ; let read_result = file . read_to_string ( & mut buff_str ) ; match read_result { Ok ( _ ) => { let parsed = buff_str . lines ( ) . flat_map ( | line | parse_configuration ( & line ) ) . collect :: < Vec < _ > > ( ) ; buff . extend ( parsed . iter ( ) . cloned ( ) ) ; } , Err ( err ) => { panic ! ( " " err ) ; } } } , Err ( err ) => { panic ! ( " " err ) ; } } buff }
Retrieve the configuration from a configuration file
Retrieve the configuration from a configuration file
path
&str
path
&str