zparse 2.0.5

High-performance JSON/TOML/YAML/XML parser with zero-allocation support
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use zparse::{Format, detect_format_from_path};

#[test]
fn detect_format_from_path_supports_extensions() {
    assert_eq!(detect_format_from_path("input.json"), Some(Format::Json));
    assert_eq!(detect_format_from_path("input.JSON"), Some(Format::Json));
    assert_eq!(detect_format_from_path("input.toml"), Some(Format::Toml));
    assert_eq!(detect_format_from_path("input.yaml"), Some(Format::Yaml));
    assert_eq!(detect_format_from_path("input.yml"), Some(Format::Yaml));
    assert_eq!(detect_format_from_path("input.xml"), Some(Format::Xml));
}

#[test]
fn detect_format_from_path_returns_none_for_unknown_or_missing_extensions() {
    assert_eq!(detect_format_from_path("input"), None);
    assert_eq!(detect_format_from_path("input.txt"), None);
}