mirror of
https://github.com/lifegpc/pixiv_downloader.git
synced 2026-07-08 01:32:41 +08:00
add support for ugoira
add progress bar
This commit is contained in:
35
src/ext/json.rs
Normal file
35
src/ext/json.rs
Normal file
@@ -0,0 +1,35 @@
|
||||
use json::JsonValue;
|
||||
|
||||
pub trait ToJson {
|
||||
fn to_json(&self) -> Option<JsonValue>;
|
||||
}
|
||||
|
||||
impl ToJson for &str {
|
||||
fn to_json(&self) -> Option<JsonValue> {
|
||||
Some(JsonValue::String(String::from(*self)))
|
||||
}
|
||||
}
|
||||
|
||||
impl ToJson for &String {
|
||||
fn to_json(&self) -> Option<JsonValue> {
|
||||
Some(JsonValue::String((*self).to_string()))
|
||||
}
|
||||
}
|
||||
|
||||
impl ToJson for String {
|
||||
fn to_json(&self) -> Option<JsonValue> {
|
||||
Some(JsonValue::String(self.to_string()))
|
||||
}
|
||||
}
|
||||
|
||||
impl ToJson for JsonValue {
|
||||
fn to_json(&self) -> Option<JsonValue> {
|
||||
Some(self.clone())
|
||||
}
|
||||
}
|
||||
|
||||
impl ToJson for &JsonValue {
|
||||
fn to_json(&self) -> Option<JsonValue> {
|
||||
Some((*self).clone())
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
pub mod cstr;
|
||||
#[cfg(feature = "flagset")]
|
||||
pub mod flagset;
|
||||
#[cfg(any(feature = "exif", feature = "avdict"))]
|
||||
pub mod json;
|
||||
#[cfg(any(feature = "exif", feature = "avdict", feature = "ugoira"))]
|
||||
pub mod rawhandle;
|
||||
|
||||
@@ -2,4 +2,9 @@
|
||||
pub trait ToRawHandle<T> {
|
||||
/// Return raw pointer of the handle
|
||||
unsafe fn to_raw_handle(&self) -> *mut T;
|
||||
|
||||
/// Return the const raw pointer of the handle
|
||||
unsafe fn to_const_handle(&self) -> *const T {
|
||||
self.to_raw_handle() as *const T
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user