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
38
39
40
41
42
43
44
45
46
47
48
use std::path::Path;
pub trait WriteToFile
{
fn write_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), std::io::Error>;
}
impl WriteToFile for Vec<u8>
{
fn write_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), std::io::Error>
{
crate::write_to_file(path, self)
}
}
impl WriteToFile for &[u8]
{
fn write_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), std::io::Error>
{
crate::write_to_file(path, self)
}
}
impl WriteToFile for String
{
fn write_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), std::io::Error>
{
crate::write_to_file(path, self)
}
}
impl WriteToFile for &str
{
fn write_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), std::io::Error>
{
crate::write_to_file(path, self)
}
}