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 std::collections::HashSet;
use std::path::{Path, PathBuf};

#[derive(Clone, Debug)]
pub struct RestoreOpts {
    pub paths: HashSet<PathBuf>,
    pub staged: bool,
    pub is_remote: bool,
    pub source_ref: Option<String>, // commit id or branch name
}

impl RestoreOpts {
    pub fn from_path<P: AsRef<Path>>(path: P) -> RestoreOpts {
        let mut paths = HashSet::new();
        paths.insert(path.as_ref().to_owned());

        RestoreOpts {
            paths,
            staged: false,
            is_remote: false,
            source_ref: None,
        }
    }

    pub fn from_staged_path<P: AsRef<Path>>(path: P) -> RestoreOpts {
        let mut paths = HashSet::new();
        paths.insert(path.as_ref().to_owned());

        RestoreOpts {
            paths,
            staged: true,
            is_remote: false,
            source_ref: None,
        }
    }

    pub fn from_path_ref<P: AsRef<Path>, S: AsRef<str>>(path: P, source_ref: S) -> RestoreOpts {
        let mut paths = HashSet::new();
        paths.insert(path.as_ref().to_owned());

        RestoreOpts {
            paths,
            staged: false,
            is_remote: false,
            source_ref: Some(source_ref.as_ref().to_owned()),
        }
    }
}