mirror of
https://github.com/lifegpc/pixiv_downloader.git
synced 2026-07-08 01:32:41 +08:00
Add support for download fanbox creator's info
This commit is contained in:
@@ -7,30 +7,58 @@ pub trait ToJson {
|
||||
fn to_json(&self) -> Option<JsonValue>;
|
||||
}
|
||||
|
||||
pub trait ToJson2 {
|
||||
fn to_json2(&self) -> JsonValue;
|
||||
}
|
||||
|
||||
impl ToJson for &str {
|
||||
fn to_json(&self) -> Option<JsonValue> {
|
||||
Some(JsonValue::String(String::from(*self)))
|
||||
}
|
||||
}
|
||||
|
||||
impl ToJson2 for &str {
|
||||
fn to_json2(&self) -> JsonValue {
|
||||
JsonValue::String(String::from(*self))
|
||||
}
|
||||
}
|
||||
|
||||
impl ToJson for String {
|
||||
fn to_json(&self) -> Option<JsonValue> {
|
||||
Some(JsonValue::String(self.to_string()))
|
||||
}
|
||||
}
|
||||
|
||||
impl ToJson2 for String {
|
||||
fn to_json2(&self) -> JsonValue {
|
||||
JsonValue::String(self.to_string())
|
||||
}
|
||||
}
|
||||
|
||||
impl ToJson for JsonValue {
|
||||
fn to_json(&self) -> Option<JsonValue> {
|
||||
Some(self.clone())
|
||||
}
|
||||
}
|
||||
|
||||
impl ToJson2 for JsonValue {
|
||||
fn to_json2(&self) -> JsonValue {
|
||||
self.clone()
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: ToJson> ToJson for &T {
|
||||
fn to_json(&self) -> Option<JsonValue> {
|
||||
(*self).to_json()
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: ToJson2> ToJson2 for &T {
|
||||
fn to_json2(&self) -> JsonValue {
|
||||
(*self).to_json2()
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: ToJson> ToJson for Option<T> {
|
||||
fn to_json(&self) -> Option<JsonValue> {
|
||||
match self {
|
||||
@@ -46,12 +74,24 @@ impl<T: ToJson> ToJson for RwLockReadGuard<'_, T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: ToJson2> ToJson2 for RwLockReadGuard<'_, T> {
|
||||
fn to_json2(&self) -> JsonValue {
|
||||
self.deref().to_json2()
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: ToJson> ToJson for RwLockWriteGuard<'_, T> {
|
||||
fn to_json(&self) -> Option<JsonValue> {
|
||||
self.deref().to_json()
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: ToJson2> ToJson2 for RwLockWriteGuard<'_, T> {
|
||||
fn to_json2(&self) -> JsonValue {
|
||||
self.deref().to_json2()
|
||||
}
|
||||
}
|
||||
|
||||
pub trait FromJson
|
||||
where
|
||||
Self: Sized,
|
||||
|
||||
Reference in New Issue
Block a user