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: area_under_curve.rs
    path of file: ./repos/Rust/src/math
    
    the code of the file until where you have to start completion: pub fn area_under_curve(start: f64, end: f64, func: fn(f64) -> f64, step_count: usize) -> f64 {
    assert!(step_count > 0);


    
pub fn area_under_curve(start: f64, end: f64, func: fn(f64) -> f64, step_count: usize) -> f64 {
    assert!(step_count > 0);

    let (start, end) = if start > end {
        (end, start)
    } else {
        (start, end)
    }; //swap if bounds reversed

    let step_length: f64 = (end - start) / step_count as f64;
    let mut area: f64 = 0f64;
    let mut fx1 = func(start);
    let mut fx2: f64;

    for eval_point in (1..step_count + 1).map(|x| (x as f64 * step_length) + start) {
        fx2 = func(eval_point);
        area += (fx2 + fx1).abs() * step_length * 0.5;
        fx1 = fx2;
    }

    area
}