asa 1.0.0

Advanced Subleq Assembler. Assembles 'sublang' to subleq
Documentation
//! Utility functions
pub fn with_thousands(s: String) -> String {
    s.as_bytes()
        .rchunks(3)
        .rev()
        .map(std::str::from_utf8)
        .collect::<Result<Vec<&str>, _>>()
        .unwrap()
        .join(",")
}

/// A vector from which items can be safely consumed whilst it
/// is being iterated over. Use a while !iter_vec.finished() loop to
/// iterate over it
pub struct IterVec<'a, T> {
    vec: &'a Vec<T>,
    index: usize,
}

impl<'a, T> IterVec<'a, T> {
    pub fn new(vec: &'a Vec<T>) -> Self {
        Self { vec, index: 0 }
    }

    pub fn current(&self) -> &T {
        &self.vec[self.index]
    }
    pub fn consume(&mut self) -> &T {
        self.index += 1;
        &self.vec[self.index - 1]
    }
    pub fn consume_n(&mut self, n: usize) {
        self.index += n;
    }
    /// Checks if the IterVec contains AT LEAST n more tokens
    pub fn contains_n_more(&self, n: usize) -> bool {
        (self.index + n) < self.vec.len()
    }
    pub fn get_relative(&self, offset: i32) -> &T {
        &self.vec[(self.index as i32 + offset) as usize]
    }
    pub fn finished(&self) -> bool {
        self.index >= self.vec.len()
    }
    pub fn len(&self) -> usize {
        self.vec.len()
    }
    pub fn is_empty(&self) -> bool {
        self.vec.len() == 0
    }
    pub fn current_index(&self) -> usize {
        self.index
    }
}