fn from_bytes_single(bytes: &[u8]) -> Result<Vec<u32>, &'static str> {
    let mut result_s = String::new();

    for byte in bytes.iter() {
        let mut num_s = format!("{:b}", byte);

        if num_s.len() == 7 {
            result_s.push_str(num_s.as_str());
            continue;
        }

        if *byte == 0 {
            result_s.push_str("0000000");
            continue;
        }

        num_s.remove(0);
        result_s.push_str(num_s.as_str());
    }

    if let Ok(i) = u32::from_str_radix(result_s.as_str(), 2) {
        Ok(vec![i])
    } else {
        Err("overflow")
    }
}
/// Given a stream of bytes, extract all numbers which are encoded in there.
Given a stream of bytes, extract all numbers which are encoded in there.
Given a stream of bytes extract all numbers which are encoded in there .
fn from_bytes_single(bytes: &[u8]) -> Result<Vec<u32>, &'static str> {
    let mut result_s = String::new();
    for byte in bytes.iter() {
        let mut num_s = format!("{:b}", byte);
        if num_s.len() == 7 {
            result_s.push_str(num_s.as_str());
            continue;
        }
        if *byte == 0 {
            result_s.push_str("0000000");
            continue;
        }
        num_s.remove(0);
        result_s.push_str(num_s.as_str());
    }
    if let Ok(i) = u32::from_str_radix(result_s.as_str(), 2) {
        Ok(vec![i])
    } else {
        Err("overflow")
    }
}
fn from_bytes_single ( bytes : & [ u8 ] ) -> Result < Vec < u32 > , & ' static str > { let mut result_s = String :: new ( ) ; for byte in bytes . iter ( ) { let mut num_s = format ! ( " " byte ) ; if num_s . len ( ) == 7 { result_s . push_str ( num_s . as_str ( ) ) ; continue ; } if * byte == 0 { result_s . push_str ( " " ) ; continue ; } num_s . remove ( 0 ) ; result_s . push_str ( num_s . as_str ( ) ) ; } if let Ok ( i ) = u32 :: from_str_radix ( result_s . as_str ( ) , 2 ) { Ok ( vec ! [ i ] ) } else { Err ( " " ) } }
Given a stream of bytes, extract all numbers which are encoded in there.
Given a stream of bytes extract all numbers which are encoded in there .
bytes
&[u8]