#[derive(Debug, Clone, Default)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct Change {
pub description: String,
pub ticket_id: Option<String>,
}
impl<T> From<T> for Change
where
T: ToString,
{
fn from(value: T) -> Self {
Self {
description: value.to_string(),
ticket_id: None,
}
}
}
impl Change {
pub fn new(description: impl ToString) -> Self {
Self {
description: description.to_string(),
..Default::default()
}
}
pub fn with_ticket_id(self, id: impl ToString) -> Self {
Self {
ticket_id: Some(id.to_string()),
..self
}
}
}