intermodal/src/sort_order.rs
Casey Rodarmor 97018031c1
Introduce "sort specs" to allow fine-grained sorting of files in torrents
Sort specs are of the form `KEY:ORDER`, and allow sorting files in a
torrent by multiple criteria. Multiple sort specs can be passed with
`--sort-by` upon torrent creation.

type: added
2020-04-07 19:01:33 -07:00

21 lines
353 B
Rust

use crate::common::*;
#[derive(Clone, Copy, Debug, PartialEq, IntoStaticStr, EnumString)]
#[strum(serialize_all = "kebab-case")]
pub(crate) enum SortOrder {
Ascending,
Descending,
}
impl SortOrder {
pub(crate) fn name(self) -> &'static str {
self.into()
}
}
impl Default for SortOrder {
fn default() -> Self {
Self::Ascending
}
}