liboxen 0.53.0

Oxen is a fast data version control system, built with machine learning training data in mind. Designed to handle terabytes of data with ease, using a workflow similar to git. Version both structured and unstructured data of any modality: text, images, video, audio, CSV, Parquet, JSONL, model checkpoints, and more. liboxen is the embeddable core library behind the oxen CLI and server, which power fine tuning and inference pipelines for multimodal LLMs, image models, and video models on Oxen.ai.
use serde::{Deserialize, Serialize};
use utoipa::ToSchema;

#[derive(Deserialize, Serialize, Debug, Clone, PartialEq, Eq, ToSchema)]
#[serde(rename_all = "snake_case")]
pub enum DiffEntryStatus {
    Added,
    Modified,
    Removed,
}

// Downcase the status
impl std::fmt::Display for DiffEntryStatus {
    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
        let status = match self {
            DiffEntryStatus::Added => "added",
            DiffEntryStatus::Modified => "modified",
            DiffEntryStatus::Removed => "removed",
        };
        write!(f, "{status}")
    }
}

// implement from_str for DiffEntryStatus
impl std::str::FromStr for DiffEntryStatus {
    type Err = String;

    fn from_str(s: &str) -> Result<Self, Self::Err> {
        match s {
            "added" => Ok(DiffEntryStatus::Added),
            "modified" => Ok(DiffEntryStatus::Modified),
            "removed" => Ok(DiffEntryStatus::Removed),
            _ => Err(format!("Could not parse {s} as a DiffEntryStatus")),
        }
    }
}