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: units.rs
    path of file: ./repos/notecalc3/notecalc-lib/src/units
    
    the code of the file until where you have to start completion: use crate::calc::pow;
use crate::units::consts::{
    get_base_unit_for, init_aliases, init_units, UnitDimensionExponent, UnitType,
    BASE_UNIT_DIMENSIONS, BASE_UNIT_DIMENSION_COUNT,
};
use crate::units::{Prefix, Unit, UnitPrefixes};
use bumpalo::core_alloc::fmt::{Debug, Display, Formatter};
use rust_decimal::prelude::One;
use rust_decimal::Decimal;
use std::collections::HashMap;
use std::convert::TryFrom;
use std::fmt::Write;
use std::ops::Mul;
use std::rc::Rc;
use std::str::FromStr;
use tinyvec::ArrayVec;

fn next(str: &[char]) -> &[char] {
    &str[1..]
}

fn parse_unit(str: &[char]) -> Option<&[char]> {
    let mut i = 0;
    for ch in str {
        if !ch.is_alphanumeric() && *ch != '$' {
            break;
        }
        i += 1;
    }
    Some(&str[0..i])
}

fn skip_whitespaces(str: &[char]) -> &[char] {
    let mut i = 0;
    for ch in str {
        if !ch.is_ascii_whitespace() {
            break;
        }
        i += 1;
    }
    &str[i..]
}

pub struct Units {
    pub prefixes: UnitPrefixes,
    pub units: HashMap<&'static str, Rc<Unit>>,
    pub aliases: HashMap<&'static str, &'static str>,
    pub no_prefix: Rc<Prefix>,
}

impl Units {
    pub fn new() -> Units {
        let (units, prefixes) = init_units();
        Units {
            no_prefix: Rc::new(Prefix::from_decimal(&[]
    
    fn test_units_j_mol_k_parsing() {
        let units = Units::new();

        let unit1 = parse("(J / mol / K)", &units);
        assert_eq!(unit1.get_unit(0).prefix.name, &[]);
        assert_eq!(unit1.get_unit(1).prefix.name, &[]);
        assert_eq!(unit1.get_unit(2).prefix.name, &[]);
        assert_eq!(unit1.get_unit(0).unit.name, &['J']);
        assert_eq!(unit1.get_unit(1).unit.name, &['m', 'o', 'l']);
        assert_eq!(unit1.get_unit(2).unit.name, &['K']);
        let parsed_len = units
            .parse(&"(J / mol / K)".chars().collect::<Vec<char>>())
            .1;
        assert_eq!(parsed_len, "(J / mol / K)".len());

        let unit1 = parse("(J / mol / K) ^ 0", &units);
        assert_eq!(unit1.get_unit(0).prefix.name, &[]);
        assert_eq!(unit1.get_unit(1).prefix.name, &[]);
        assert_eq!(unit1.get_unit(2).prefix.name, &[]);
        assert_eq!(unit1.get_unit(0).unit.name, &['J']);
        assert_eq!(unit1.get_unit(1).unit.name, &['m', 'o', 'l']);
        assert_eq!(unit1.get_unit(2).unit.name, &['K']);

        let parsed_len = units
            .parse(&"(J / mol / K) ^ 0".chars().collect::<Vec<char>>())
            .1;
        // it cannot parse the exponent
        assert_eq!(parsed_len, "(J / mol / K)".len());

        // e.g. if the input is (8.314 J / mol / K)
        let parsed_len = units
            .parse(&"J / mol / K)".chars().collect::<Vec<char>>())
            .1;
        assert_eq!(parsed_len, "J / mol / K".len());
    }