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: error.rs
    path of file: ./repos/eva/src
    
    the code of the file until where you have to start completion: /* Copyright (C) 2019  Akshay Oppiliappan <nerdypepper@tuta.io>
 * Refer to LICENCE for more information.
 * */

use std::fmt;
use std::iter::ExactSizeIterator;

use crate::lex;

/// Math related errors.
#[derive(Debug, PartialEq, Eq)]
pub enum MathError {
    DivideByZero,
    OutOfBounds,
    UnknownBase,
    TooLarge,
}

/// Generic calculation errors.
#[derive(Debug, PartialEq, Eq)]
pub enum CalcError {
    Math(MathError),
    Syntax(String),
    Parser(String),
    Help,
}

impl fmt::Display for CalcError {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            CalcError::Math(math_err) => match math_err {
                MathError::DivideByZero => write!(f, "Math Error: Divide by zero error!"),
                MathError::OutOfBounds => write!(f, "Domain Error: Out of bounds!"),
                MathError::UnknownBase => write!(f, "Base too large! Accepted ranges: 0 - 36"),
                MathError::TooLarge => {
                    write!(f, "Error: to large to process! Max value: {}", f64::MAX)
                }
            },
            CalcError::Syntax(details) => write!(f, "Syntax Error: {}", details),
            CalcError::Parser(details) => write!(f, "Parser Error: {}", details),
            CalcError::Help => {
                // calculate max wi
    
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            CalcError::Math(math_err) => match math_err {
                MathError::DivideByZero => write!(f, "Math Error: Divide by zero error!"),
                MathError::OutOfBounds => write!(f, "Domain Error: Out of bounds!"),
                MathError::UnknownBase => write!(f, "Base too large! Accepted ranges: 0 - 36"),
                MathError::TooLarge => {
                    write!(f, "Error: to large to process! Max value: {}", f64::MAX)
                }
            },
            CalcError::Syntax(details) => write!(f, "Syntax Error: {}", details),
            CalcError::Parser(details) => write!(f, "Parser Error: {}", details),
            CalcError::Help => {
                // calculate max width but ideally this should be calculated once
                // TODO remove terminal_size from lib dependency
                let mut max_width = 79; // capped at 79
                if let Some((terminal_size::Width(w), _)) = terminal_size::terminal_size() {
                    if (w as usize) < max_width {
                        max_width = w as usize;
                    }
                }
                let operators: Vec<_> = lex::OPERATORS.keys().map(|c| c.to_string()).collect();
                write!(
                    f,
                    "Constants\n{}\nFunctions\n{}\nOperators\n{}\n",
                    blocks(max_width, lex::CONSTANTS.keys().cloned()),
                    blocks(max_width, lex::FUNCTIONS.keys().cloned()),
                    operators.join(" ")
                )
            }
        }
    }