blob: 5486dc17ccf67b95334b40bcaa88cc1ba39a0081 (
plain)
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
49
50
|
use std::{path::PathBuf, time::Duration};
pub use self::error::Error;
mod error;
pub mod path;
#[cfg(feature = "git")]
pub mod git;
pub type ProjectItem = Box<dyn Project>;
pub trait Project: Timestamp {
fn to_path_buf(&self) -> &PathBuf;
}
impl<T> Project for T
where
T: Timestamp,
T: AsRef<PathBuf>,
{
fn to_path_buf(&self) -> &PathBuf {
self.as_ref()
}
}
pub trait ProjectParser {
fn parse_project(&self, path_buf: PathBuf) -> Option<ProjectItem>;
}
pub trait Timestamp {
fn timestamp(&self) -> &Duration;
}
impl<T> Timestamp for T
where
T: AsRef<Duration>,
{
fn timestamp(&self) -> &Duration {
self.as_ref()
}
}
#[cfg(feature = "preview")]
pub trait Preview {
type Error;
fn preview(&self) -> Result<(), Self::Error>;
}
|