get_dir/structs/target/file.rs
1/// File target struct.
2#[derive(Debug, Clone, PartialEq, Eq)]
3pub struct FileTarget {
4 /// The name of the file target.
5 ///
6 /// By default, it is a empty string.
7 pub name: String,
8}
9
10impl FileTarget {
11 /// Create a new file target.
12 ///
13 /// ## Example
14 ///
15 /// ```no_run
16 /// use get_dir::FileTarget;
17 ///
18 /// let target: FileTarget = FileTarget::new("Cargo.toml");
19 /// ```
20 pub fn new<N: Into<String>>(name: N) -> Self {
21 Self { name: name.into() }
22 }
23}
24
25impl Default for FileTarget {
26 fn default() -> Self {
27 Self::new("")
28 }
29}