diff options
author | Radosław Kot <rdkt13@gmail.com> | 2021-07-31 16:40:52 +0200 |
---|---|---|
committer | Radosław Kot <rdkt13@gmail.com> | 2021-10-23 16:58:41 +0200 |
commit | abe7f7624a02261cde994d5128d44c63fe65dd60 (patch) | |
tree | 9998f76719a0a35b956952522fac22c1309fea81 /src/file/source/mod.rs | |
parent | 0cf715faf39ce0ac28e228eeb4874c374e1f0594 (diff) |
Make File generic over Format and FileExtensions
Diffstat (limited to 'src/file/source/mod.rs')
-rw-r--r-- | src/file/source/mod.rs | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/file/source/mod.rs b/src/file/source/mod.rs index 3b42a55..4a8877b 100644 --- a/src/file/source/mod.rs +++ b/src/file/source/mod.rs @@ -4,12 +4,15 @@ pub mod string; use std::error::Error; use std::fmt::Debug; -use crate::file::FileFormat; +use crate::{file::FileExtensions, Format}; /// Describes where the file is sourced -pub trait FileSource: Debug + Clone { +pub trait FileSource<T>: Debug + Clone +where + T: Format + FileExtensions, +{ fn resolve( &self, - format_hint: Option<FileFormat>, - ) -> Result<(Option<String>, String, FileFormat), Box<dyn Error + Send + Sync>>; + format_hint: Option<T>, + ) -> Result<(Option<String>, String, Box<dyn Format>), Box<dyn Error + Send + Sync>>; } |