35 lines
905 B
Rust
35 lines
905 B
Rust
|
use crate::BranchName;
|
||
|
|
||
|
/// Mapped from `.git-next.toml` file at `branches`
|
||
|
#[derive(Clone, Debug, PartialEq, Eq, serde::Deserialize)]
|
||
|
pub struct RepoBranches {
|
||
|
pub main: String,
|
||
|
pub next: String,
|
||
|
pub dev: String,
|
||
|
}
|
||
|
impl RepoBranches {
|
||
|
pub fn new(main: impl Into<String>, next: impl Into<String>, dev: impl Into<String>) -> Self {
|
||
|
Self {
|
||
|
main: main.into(),
|
||
|
next: next.into(),
|
||
|
dev: dev.into(),
|
||
|
}
|
||
|
}
|
||
|
pub fn main(&self) -> BranchName {
|
||
|
BranchName(self.main.clone())
|
||
|
}
|
||
|
|
||
|
pub fn next(&self) -> BranchName {
|
||
|
BranchName(self.next.clone())
|
||
|
}
|
||
|
|
||
|
pub fn dev(&self) -> BranchName {
|
||
|
BranchName(self.dev.clone())
|
||
|
}
|
||
|
}
|
||
|
impl std::fmt::Display for RepoBranches {
|
||
|
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
|
||
|
write!(f, "{},{},{}", self.main, self.next, self.dev)
|
||
|
}
|
||
|
}
|