#[derive(serde::Serialize, serde::Deserialize, Debug, Eq, PartialEq, Clone)] pub struct LoginRedirect(String); impl LoginRedirect { pub fn get(&self) -> &str { match self.0.starts_with('/') && !self.0.starts_with("//") { true => self.0.as_str(), false => "/", } } pub fn get_encoded(&self) -> String { urlencoding::encode(self.get()).to_string() } } impl Default for LoginRedirect { fn default() -> Self { Self("/".to_string()) } }