fn decode_local_time_data(&self, reader: &mut Cursor<&[u8]>) -> Result<Vec<TzType>, std::io::Error> {
        let mut local_time_data = Vec::<TzType>::new();
        let mut raw_local_time_data = vec![];

        for _ in 0..self.inner.tzh_typecnt {
            let ut_offset = try!(reader.read_i32::<BigEndian>());
            let isdst = try!(reader.read_u8());
            let abbr_index = try!(reader.read_u8());

            raw_local_time_data.push((ut_offset, isdst, abbr_index));
        }

        let mut charbuf = vec![0u8; self.inner.tzh_charcnt as usize];
        try!(reader.read(&mut charbuf[..]));

        for (ut_offset, isdst, abbr_index) in raw_local_time_data {
            // In C: strcpy(abbreviation, &charbuf[abbr_index]) -- also a solution possible without clone?
            let abbr:Vec<_> = charbuf.clone().into_iter()
                                     .skip(abbr_index as usize)
                                     .take_while(|&c| c > 0)
                                     .collect();
            let abbreviation = std::str::from_utf8(&abbr[..]).unwrap(); // FIXME: improve error handling
            local_time_data.push(TzType{
                ut_offset: ut_offset,
                isdst: isdst != 0,
                abbreviation: abbreviation.to_string(),
            })
        }

        Ok(local_time_data)
    }
/// returns local time startings data
///
/// this function consumes the char buffer as well to incorperate it in the result
///
/// the function assumes that the provided cursor is located at the the start of the
/// table with local time startings data
returns local time startings data
this function consumes the char buffer as well to incorperate it in the result

the function assumes that the provided cursor is located at the the start of the
table with local time startings data
returns local time startings data this function consumes the char buffer as well to incorperate it in the result the function assumes that the provided cursor is located at the the start of the table with local time startings data
fn decode_local_time_data(&self, reader: &mut Cursor<&[u8]>) -> Result<Vec<TzType>, std::io::Error> {
        let mut local_time_data = Vec::<TzType>::new();
        let mut raw_local_time_data = vec![];
        for _ in 0..self.inner.tzh_typecnt {
            let ut_offset = try!(reader.read_i32::<BigEndian>());
            let isdst = try!(reader.read_u8());
            let abbr_index = try!(reader.read_u8());
            raw_local_time_data.push((ut_offset, isdst, abbr_index));
        }
        let mut charbuf = vec![0u8; self.inner.tzh_charcnt as usize];
        try!(reader.read(&mut charbuf[..]));
        for (ut_offset, isdst, abbr_index) in raw_local_time_data {
            // In C: strcpy(abbreviation, &charbuf[abbr_index]) -- also a solution possible without clone?
            let abbr:Vec<_> = charbuf.clone().into_iter()
                                     .skip(abbr_index as usize)
                                     .take_while(|&c| c > 0)
                                     .collect();
            let abbreviation = std::str::from_utf8(&abbr[..]).unwrap(); // FIXME: improve error handling
            local_time_data.push(TzType{
                ut_offset: ut_offset,
                isdst: isdst != 0,
                abbreviation: abbreviation.to_string(),
            })
        }
        Ok(local_time_data)
    }
fn decode_local_time_data ( & self , reader : & mut Cursor < & [ u8 ] > ) -> Result < Vec < TzType > , std :: io :: Error > { let mut local_time_data = Vec :: < TzType > :: new ( ) ; let mut raw_local_time_data = vec ! [ ] ; for _ in 0 .. self . inner . tzh_typecnt { let ut_offset = try ! ( reader read_i32 BigEndian ( ) ) ; let isdst = try ! ( reader read_u8 ( ) ) ; let abbr_index = try ! ( reader read_u8 ( ) ) ; raw_local_time_data . push ( ( ut_offset , isdst , abbr_index ) ) ; } let mut charbuf = vec ! [ 0u8 self inner tzh_charcnt as usize ] ; try ! ( reader read ( mut charbuf [ ] ) ) ; for ( ut_offset , isdst , abbr_index ) in raw_local_time_data { // In C: strcpy(abbreviation, &charbuf[abbr_index]) -- also a solution possible without clone? let abbr : Vec < _ > = charbuf . clone ( ) . into_iter ( ) . skip ( abbr_index as usize ) . take_while ( | & c | c > 0 ) . collect ( ) ; let abbreviation = std :: str :: from_utf8 ( & abbr [ .. ] ) . unwrap ( ) ; // FIXME: improve error handling local_time_data . push ( TzType { ut_offset : ut_offset , isdst : isdst != 0 , abbreviation : abbreviation . to_string ( ) , } ) } Ok ( local_time_data ) }
returns local time startings data
this function consumes the char buffer as well to incorperate it in the result
returns local time startings data this function consumes the char buffer as well to incorperate it in the result
&self
reader
&mut Cursor<&[u8]>