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;

/// trait version of `write_to_file`.
/// See also: `write_to_file::write_to_file`
pub trait WriteToFile
{
 fn write_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), std::io::Error>;
}

/// impl Vec<u8> version of trait of `write_to_file`.
/// See also: `write_to_file::write_to_file`
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 &[u8] version of trait of `write_to_file`.
/// See also: `write_to_file::write_to_file`
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 String version of trait of `write_to_file`.
/// See also: `write_to_file::write_to_file`
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 &str version of trait of `write_to_file`.
/// See also: `write_to_file::write_to_file`
impl WriteToFile for &str
{
 fn write_to_file<P: AsRef<Path>>(&self, path: P) -> Result<(), std::io::Error>
 {
  crate::write_to_file(path, self)
 }
}