1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
use ;
use ;
/**
* Serialize a Vec<u8> as a PathBuf.
*
* # Example
*
* ```
* use std::path::PathBuf;
* use serde::Serialize;
* use serde_path::serialize_path;
*
* let bytes = vec![b'/', b't', b'm', b'p'];
* let path = PathBuf::from("/tmp");
* let serialized = serde_json::to_string(&path).unwrap();
* assert_eq!(serialized, r#""/tmp""#);
* ```
*
* # Errors
*
* If the bytes are not valid UTF-8, an error will be returned.
*
* # Safety
*
* This function is unsafe because it creates an OsString from the bytes without checking if the bytes are valid UTF-8.
*
*/