diff options
author | Radosław Kot <rdkt13@gmail.com> | 2021-09-30 22:23:23 +0200 |
---|---|---|
committer | Radosław Kot <rdkt13@gmail.com> | 2021-10-23 16:58:41 +0200 |
commit | 583a47764a93465ce8d846a6a7273a9bd38fd554 (patch) | |
tree | cb0b8a6bac0ca105ef9e8c04b5a135b3bb19a4dc /src | |
parent | 6fa1b27f08afb8e8ec81f36ddfff69a23c2d73d6 (diff) |
Change FileExtensions signature
Diffstat (limited to 'src')
-rw-r--r-- | src/file/extension.rs | 4 | ||||
-rw-r--r-- | src/file/format/mod.rs | 11 |
2 files changed, 5 insertions, 10 deletions
diff --git a/src/file/extension.rs b/src/file/extension.rs index 75ca557..ff67492 100644 --- a/src/file/extension.rs +++ b/src/file/extension.rs @@ -4,11 +4,11 @@ /// 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. +/// 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) -> &Vec<&'static str>; + fn extensions(&self) -> &'static [&'static str]; } diff --git a/src/file/format/mod.rs b/src/file/format/mod.rs index 4238227..a335426 100644 --- a/src/file/format/mod.rs +++ b/src/file/format/mod.rs @@ -85,19 +85,14 @@ lazy_static! { } impl FileFormat { - // TODO: pub(crate) - #[doc(hidden)] - pub fn extensions(&self) -> &'static Vec<&'static str> { + pub (crate) fn extensions(&self) -> &'static [&'static str] { // It should not be possible for this to fail // A FileFormat would need to be declared without being added to the // ALL_EXTENSIONS map. ALL_EXTENSIONS.get(self).unwrap() } - // TODO: pub(crate) - #[doc(hidden)] - #[allow(unused_variables)] - pub fn parse( + pub (crate) fn parse( &self, uri: Option<&String>, text: &str, @@ -135,7 +130,7 @@ impl Format for FileFormat { } impl FileExtensions for FileFormat { - fn extensions(&self) -> &Vec<&'static str> { + fn extensions(&self) -> &'static [&'static str] { self.extensions() } } |