Parse from a string (case-insensitive).
(s: &str)
| 142 | |
| 143 | /// Parse from a string (case-insensitive). |
| 144 | pub fn parse(s: &str) -> Self { |
| 145 | match s.to_lowercase().as_str() { |
| 146 | "personal" | "p" => IdentityUsage::Personal, |
| 147 | "work" | "w" => IdentityUsage::Work, |
| 148 | "community" | "c" => IdentityUsage::Community, |
| 149 | "bot" | "b" => IdentityUsage::Bot, |
| 150 | other => IdentityUsage::Custom(other.to_string()), |
| 151 | } |
| 152 | } |
| 153 | |
| 154 | /// Get all standard usage types (excluding Custom). |
| 155 | pub fn standard_types() -> &'static [IdentityUsage] { |