1use std::path::Path;
2
3pub trait WriteToFile
6{
7 fn write_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), std::io::Error>;
8}
9
10impl WriteToFile for Vec<u8>
13{
14 fn write_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), std::io::Error>
15 {
16 crate::write_to_file(path, self)
17 }
18}
19
20impl WriteToFile for &[u8]
23{
24 fn write_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), std::io::Error>
25 {
26 crate::write_to_file(path, self)
27 }
28}
29
30impl WriteToFile for String
33{
34 fn write_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), std::io::Error>
35 {
36 crate::write_to_file(path, self)
37 }
38}
39
40impl WriteToFile for &str
43{
44 fn write_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), std::io::Error>
45 {
46 crate::write_to_file(path, self)
47 }
48}