overcast 0.1.3

Strongly typed changelogs for projects as changeable as the weather
Documentation
/// A single change
#[derive(Debug, Clone, Default)]
#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
pub struct Change {
    /// A text description of the change that was made
    pub description: String,
    /// An id to link out to an external issue tracker or ticketing system
    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 {
    /// Create a new Change from a description
    pub fn new(description: impl ToString) -> Self {
        Self {
            description: description.to_string(),
            ..Default::default()
        }
    }

    /// Set the ticket id of the change
    pub fn with_ticket_id(self, id: impl ToString) -> Self {
        Self {
            ticket_id: Some(id.to_string()),
            ..self
        }
    }
}