Files
gitust/src/gitutils/gitfile.rs
2021-07-19 13:30:25 +02:00

22 lines
456 B
Rust

use std::fmt::{Display, Formatter};
use std::path::{PathBuf};
use std::ffi::OsStr;
#[derive(Debug)]
pub struct GitFile(pub PathBuf);
impl GitFile {
pub(crate) fn new(fullname : PathBuf) -> GitFile {
GitFile(fullname)
}
pub fn name(&self) -> Option<&OsStr> {
self.0.file_name()
}
}
impl Display for GitFile {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.0.display())
}
}