mirror of
https://forge.pointfixe.fr/hubert/gitust.git
synced 2026-02-04 20:57:28 +01:00
22 lines
456 B
Rust
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())
|
|
}
|
|
}
|