Support download fanbox image post

This commit is contained in:
2022-07-15 09:16:31 +00:00
committed by GitHub
parent 26f2bb32bd
commit 8cdde2fd65
8 changed files with 217 additions and 24 deletions

View File

@@ -18,7 +18,10 @@ pub trait ExifDataSource {
}
impl<T: ExifDataSource> ExifDataSource for std::sync::Arc<T> {
call_parent_data_source_fun!("src/data/exif_data_source.json", *self,);
call_parent_data_source_fun!(
"src/data/exif_data_source.json",
std::ops::Deref::deref(self),
);
}
impl<T: ExifDataSource> ExifDataSource for Option<T> {

View File

@@ -29,6 +29,16 @@ impl FanboxData {
}
}
impl Clone for FanboxData {
fn clone(&self) -> Self {
Self {
id: self.id.clone(),
raw: self.raw.clone(),
exif_data: None,
}
}
}
#[cfg(feature = "exif")]
impl ExifDataSource for FanboxData {
call_parent_data_source_fun!(

View File

@@ -120,6 +120,17 @@ impl From<FanboxData> for JSONDataFile {
}
}
impl From<&FanboxData> for JSONDataFile {
fn from(d: &FanboxData) -> Self {
let mut f = Self {
id: d.id.clone(),
maps: HashMap::new(),
};
f.add("raw", d.raw.clone()).unwrap();
f
}
}
impl ToJson for JSONDataFile {
fn to_json(&self) -> Option<JsonValue> {
let mut value = json::object! {};