cataclysm 0.5.5

A simple http framework
Documentation
/// Representation of the X-Forwarded-For header, for quick ip address lookup when using an nginx reverse proxy
///
/// Note: this struct implements the [Display](std::fmt::Display) trait. When no header was found, the `null` string gets printed.
#[derive(Clone, Debug)]
pub struct XForwardedFor {
    pub(crate) data: Option<String>
}

impl std::fmt::Display for XForwardedFor {
    fn fmt(&self, formatter: &mut std::fmt::Formatter) -> Result<(), std::fmt::Error> {
        match &self.data {
            Some(content) => write!(formatter, "{}", content),
            None => write!(formatter, "null")
        }
    }
}

impl XForwardedFor {
    /// Retrieves the inner first match of the X-Forwarded-For header
    pub fn into_inner(self) -> Option<String> {
        self.data
    }
}