gazetta_core/model/
index.rs

1//  Copyright (C) 2015 Steven Allen
2//
3//  This file is part of gazetta.
4//
5//  This program is free software: you can redistribute it and/or modify it under the terms of the
6//  GNU General Public License as published by the Free Software Foundation version 3 of the
7//  License.
8//
9//  This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
10//  without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See
11//  the GNU General Public License for more details.
12//
13//  You should have received a copy of the GNU General Public License along with this program.  If
14//  not, see <http://www.gnu.org/licenses/>.
15//
16
17use glob;
18
19#[derive(Debug, Clone, Copy, Eq, PartialEq)]
20pub enum SortField {
21    Date,
22    Title,
23}
24
25#[derive(Clone, Debug, Copy, Eq, PartialEq)]
26pub enum SortDirection {
27    Ascending,
28    Descending,
29}
30
31#[derive(Default, Clone, Debug, Copy, Eq, PartialEq)]
32pub struct Sort {
33    pub field: SortField,
34    pub direction: SortDirection,
35}
36
37impl Default for SortField {
38    fn default() -> SortField {
39        SortField::Title
40    }
41}
42
43impl Default for SortDirection {
44    fn default() -> SortDirection {
45        SortDirection::Descending
46    }
47}
48
49#[derive(Debug, Clone)]
50pub struct Index {
51    pub sort: Sort,
52    pub directories: Vec<glob::Pattern>,
53    pub paginate: Option<u32>,
54    pub max: Option<u32>,
55    pub compact: bool,
56}