git-next/crates/git/src/git_remote.rs

24 lines
601 B
Rust
Raw Normal View History

use git_next_config::{Hostname, RepoPath};
#[derive(Clone, Debug, PartialEq, Eq)]
pub struct GitRemote {
host: Hostname,
repo_path: RepoPath,
}
impl GitRemote {
pub const fn new(host: Hostname, repo_path: RepoPath) -> Self {
Self { host, repo_path }
}
pub const fn host(&self) -> &Hostname {
&self.host
}
pub const fn repo_path(&self) -> &RepoPath {
&self.repo_path
}
}
impl std::fmt::Display for GitRemote {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}:{}", self.host, self.repo_path)
}
}