serde_yaml_gtc 2.5.3

Temp copy for serde_yaml_bw until version 2.5.3 is on crates. YAML support for Serde with an emphasis on panic-free parsing (including malformed YAML).
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use serde_yaml_gtc as yaml;

#[test]
fn test_serialize_bytes() {
    let bytes: &[u8] = &[1, 2, 3];
    let s = yaml::to_string(&bytes).unwrap();
    assert_eq!(s, "- 1\n- 2\n- 3\n");
}

#[test]
fn test_deserialize_byte_sequence() {
    let yaml = "- 1\n- 2\n- 3\n";
    let bytes: Vec<u8> = yaml::from_str(yaml).unwrap();
    assert_eq!(bytes, vec![1, 2, 3]);
}