(s: &str)
| 204 | } |
| 205 | |
| 206 | pub fn lookup_format(s: &str) -> Result<&'static dyn Format, EvalError> { |
| 207 | let s = UncasedStr::new(s); |
| 208 | if s == "base64" { |
| 209 | Ok(&Base64Format) |
| 210 | } else if s == "escape" { |
| 211 | Ok(&EscapeFormat) |
| 212 | } else if s == "hex" { |
| 213 | Ok(&HexFormat) |
| 214 | } else { |
| 215 | Err(EvalError::InvalidEncodingName(s.as_str().into())) |
| 216 | } |
| 217 | } |