blob: e1d9f6456aa5747e1fb5a8bee96bb86b0ae55912 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
|
use std::str::FromStr;
use std::result;
use std::error::Error;
use source::Source;
use super::{FileSource, FileFormat};
/// Describes a file sourced from a string
pub struct FileSourceString(String);
impl<'a> From<&'a str> for FileSourceString {
fn from(s: &'a str) -> Self {
FileSourceString(s.into())
}
}
impl FileSource for FileSourceString {
fn resolve(&self, _: Option<FileFormat>) -> Result<(Option<String>, String), Box<Error>> {
Ok((None, self.0.clone()))
}
}
|