summaryrefslogtreecommitdiffstats
path: root/src/file/extension.rs
blob: ff67492b3942dd8b0f0df13cc1efd1b21cec6f40 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
/// Describes an entity that can return file extensions.
///
/// Meant primarily for [`Format`](crate::Format) trait.
/// Since [`Format`](crate::Format) only describes certain internal encoding, for instance JSON or Yaml
/// it is not necessarily bound to file extension name.
///
/// In networking context JSONs are used without file extensions.
/// One can also imagine some encodings that do not necessarily have file extension associated, for instance
/// MessagePack or bincode.
/// Hence the decision to have extensions separated from [`Format`](crate::Format).
pub trait FileExtensions {
    /// Returns a vector of file extensions, for instance `[yml, yaml]`.
    fn extensions(&self) -> &'static [&'static str];
}