lest 0.2.1

A modular approach to a web server. Based on actix-web.
Documentation
#[derive(Debug)]
/// A `Rewrite` allows you to rewrite a path from one path to another.
pub struct Rewrite {
    pub from: String,
    pub to: String,
}

impl Rewrite {
    /// This function creates a new `Rewrite` from a `from` and `to` path.
    pub fn new(from: String, to: String) -> Self {
        let from_parts = from.split("/").collect::<Vec<&str>>();
        let to_parts = to.split("/").collect::<Vec<&str>>();
        let from_parts_in = from_parts.clone();
        let to_parts_in = to_parts.clone();
        let mut end = false;
        let mut index = 0;
        for (from_part, to_part) in from_parts.into_iter().zip(to_parts) {
            if from_parts_in[index] == "*" {
                if to_parts_in[index] != "*" {
                    panic!("Rewrite from and to must have the same number of parts");
                }
            } else if from_part == "**" {
                if to_part != "**" {
                    panic!("Rewrite from and to must have the same number of parts");
                }
                if from_parts_in[index + 1] != "" {
                    panic!("** must be at the end of the from path");
                }
                if to_parts_in[index + 1] != "" {
                    panic!("** must be at the end of the to path");
                }
                end = true;
            }
            index += 1;
        }

        if !end {
            panic!("Rewrite from and to must have the same number of parts");
        }

        Rewrite {
            from,
            to,
        }
    }
}