1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use super::listing::ListingRenderer;
use std::{collections::HashSet, sync::Arc};

/// Tells the `FilesService` how to handle a user request for a directory path.
#[derive(Clone)]
pub enum IndexStrategy {
  /// Renders a directory listing when a direct path is requested.
  AlwaysShowListing { renderer: Arc<ListingRenderer> },
  /// Attempts to retrieve one of the specified index files when a directory
  /// path is requested, otherwise, it renders a directory listing.
  ShowListingWhenAbsent {
    renderer: Arc<ListingRenderer>,
    filenames: HashSet<String>,
  },
  /// Attempts to retrieve one of the specified index files when a directory
  /// path is requested, otherwise, it returns a 404.
  IndexFiles { filenames: HashSet<String> },
  /// Returns a 404 if a directory path is requested.
  NoIndex,
}