attempt_snippet_parse

Function attempt_snippet_parse 

Source
pub fn attempt_snippet_parse<T: FuzzyFromJsonValue>(
    raw_clipboard: &str,
    type_name: &str,
    fail_dir: Option<&PathBuf>,
) -> Result<Option<T>, ()>
Expand description

Tries to parse the raw clipboard as type T.
Returns: Ok(Some(value)) if parse succeeded, Ok(None) if it wasn’t valid at all for that type (like a total JSON parse fail), Err(()) if it was valid JSON but fuzzy parse failed => we store it in fail-dir.