You are an expert in writing code in many different languages. Your goal is to perform code completion for the following code, keeping in mind the rest of the code and the file meta data.
    Metadata details:
    filename: unit_fmt.rs
    path of file: ./repos/LocustDB/src
    
    the code of the file until where you have to start completion: use std::fmt;


pub fn bite(quantity: usize) -> UnitFormatter {
    UnitFormatter::new(quantity as f64, 1024, 0, IEC_PREFIXES, "B".to_string())
}

pub fn ns(quantity: usize) -> UnitFormatter {
    UnitFormatter::new(quantity as f64, 1000, 5, SI_PREFIXES, "s".to_string())
}

pub fn byte(quantity: f64) -> UnitFormatter {
    UnitFormatter::new(quantity, 1000, 8, SI_PREFIXES, "B".to_string())
}

pub fn second(quantity: usize) -> UnitFormatter {
    UnitFormatter::new(quantity as f64, 1000, 8, SI_PREFIXES, "s".to_string())
}

pub fn billion(quantity: f64) -> UnitFormatter {
    short_scale(quantity * 1_000_000_000.0)
}

pub fn short_scale(quantity: f64) -> UnitFormatter {

    
    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
        let sig_figs = f.precision().unwrap_or(3);
        let mut i = self.power;
        let mut ratio = 1.0;
        while (self.quantity / ratio) < 1.0 && i > 0 {
            ratio /= self.ratio as f64;
            i -= 1;
        }
        while (self.quantity / ratio).log10() > sig_figs as f64 && i + 1 < self.prefixes.len() {
            ratio *= self.ratio as f64;
            i += 1;
        }
        let quantity = self.quantity / ratio;
        let digits = quantity.log10().floor() as isize + 1;
        let precision = if digits < 0 {
            sig_figs
        } else if digits < sig_figs as isize {
            (sig_figs as isize - digits) as usize
        } else { 0 };
        write!(f, "{:.prec$}{}{}",
               quantity,
               self.prefixes[i],
               &self.suffix,
               prec = precision)
    }