stitchy_core/enums.rs
1
2#[cfg(feature = "parser")]
3use clap::ValueEnum;
4
5#[cfg(feature = "parser")]
6use serde::{Serialize, Deserialize};
7
8/// Configure which end of the set of files to take from. The first file used will be the one
9/// at the specified end, and then the next file in from the end, and so on.
10/// The meaning of [TakeFrom::Start] or [TakeFrom::End] depends on the ordering specified with
11/// [OrderBy].
12///
13/// With files named "a.jpg", "b.jpg", and "c.jpg", electing to stitch 2 files together with
14/// [OrderBy::Alphabetic], then [TakeFrom::Start] will process files "a.jpg" then "b.jpg",
15/// while [TakeFrom::End] will process files "c.jpg" then "b.jpg".
16///
17/// For ordering [OrderBy::Latest], the last-updated timestamps of the files determines the
18/// order: [TakeFrom::Start] will begin with the most recent file first and working backwards,
19/// while [TakeFrom::End] will take the oldest file and work forwards.
20#[derive(PartialEq, Debug, Copy, Clone, Default)]
21#[cfg_attr(feature = "parser", derive(ValueEnum, Serialize, Deserialize))]
22pub enum TakeFrom {
23 #[default]
24 Start,
25 End
26}
27
28/// Configure the order in which files are taken when selecting files from a set.
29/// Specify which end of the list to take files from when stitching using [TakeFrom].
30#[derive(PartialEq, Debug, Copy, Clone, Default)]
31#[cfg_attr(feature = "parser", derive(ValueEnum, Serialize, Deserialize))]
32pub enum OrderBy {
33 #[default]
34 Latest,
35 Alphabetic
36}