cleanup
This commit is contained in:
parent
7820a409bf
commit
3e69eed22f
7 changed files with 51 additions and 21 deletions
|
@ -24,8 +24,6 @@ pub async fn read_text() -> crate::Result<String> {
|
||||||
/// write_text("Tauri is awesome!").await;
|
/// write_text("Tauri is awesome!").await;
|
||||||
/// assert_eq!(read_text().await, "Tauri is awesome!");
|
/// assert_eq!(read_text().await, "Tauri is awesome!");
|
||||||
/// ```
|
/// ```
|
||||||
///
|
|
||||||
/// @returns A promise indicating the success or failure of the operation.
|
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
pub async fn write_text(text: &str) -> crate::Result<()> {
|
pub async fn write_text(text: &str) -> crate::Result<()> {
|
||||||
Ok(inner::writeText(text).await?)
|
Ok(inner::writeText(text).await?)
|
||||||
|
|
|
@ -67,7 +67,6 @@ pub async fn emit<T: Serialize>(event: &str, payload: &T) -> crate::Result<()> {
|
||||||
///
|
///
|
||||||
/// @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`.
|
/// @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`.
|
||||||
/// @param handler Event handler callback.
|
/// @param handler Event handler callback.
|
||||||
/// @returns A promise resolving to a function to unlisten to the event.
|
|
||||||
///
|
///
|
||||||
/// Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
|
/// Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
|
@ -112,7 +111,6 @@ where
|
||||||
/// ```
|
/// ```
|
||||||
///
|
///
|
||||||
/// @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`.
|
/// @param event Event name. Must include only alphanumeric characters, `-`, `/`, `:` and `_`.
|
||||||
/// @returns A promise resolving to a function to unlisten to the event.
|
|
||||||
///
|
///
|
||||||
/// Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
|
/// Note that removing the listener is required if your listener goes out of scope e.g. the component is unmounted.
|
||||||
#[inline(always)]
|
#[inline(always)]
|
||||||
|
|
|
@ -1,41 +1,30 @@
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
|
|
||||||
|
#[inline(always)]
|
||||||
pub async fn is_permission_granted() -> crate::Result<bool> {
|
pub async fn is_permission_granted() -> crate::Result<bool> {
|
||||||
let raw = inner::isPermissionGranted().await?;
|
let raw = inner::isPermissionGranted().await?;
|
||||||
|
|
||||||
Ok(serde_wasm_bindgen::from_value(raw)?)
|
Ok(serde_wasm_bindgen::from_value(raw)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline(always)]
|
||||||
pub async fn request_permission() -> crate::Result<Permission> {
|
pub async fn request_permission() -> crate::Result<Permission> {
|
||||||
let raw = inner::requestPermission().await?;
|
let raw = inner::requestPermission().await?;
|
||||||
|
|
||||||
Ok(serde_wasm_bindgen::from_value(raw)?)
|
Ok(serde_wasm_bindgen::from_value(raw)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Debug, Default, Clone, Copy, PartialEq, Eq)]
|
#[derive(Debug, Deserialize, Default, Clone, Copy, PartialEq, Eq)]
|
||||||
pub enum Permission {
|
pub enum Permission {
|
||||||
#[default]
|
#[default]
|
||||||
|
#[serde(rename = "default")]
|
||||||
Default,
|
Default,
|
||||||
|
#[serde(rename = "granted")]
|
||||||
Granted,
|
Granted,
|
||||||
|
#[serde(rename = "denied")]
|
||||||
Denied,
|
Denied,
|
||||||
}
|
}
|
||||||
|
|
||||||
impl<'de> Deserialize<'de> for Permission {
|
|
||||||
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>
|
|
||||||
where
|
|
||||||
D: serde::Deserializer<'de>,
|
|
||||||
{
|
|
||||||
match String::deserialize(deserializer)?.as_str() {
|
|
||||||
"default" => Ok(Permission::Default),
|
|
||||||
"granted" => Ok(Permission::Granted),
|
|
||||||
"denied" => Ok(Permission::Denied),
|
|
||||||
_ => Err(serde::de::Error::custom(
|
|
||||||
"expected one of default, granted, denied",
|
|
||||||
)),
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
#[derive(Debug, Default, Serialize)]
|
#[derive(Debug, Default, Serialize)]
|
||||||
pub struct Notification<'a> {
|
pub struct Notification<'a> {
|
||||||
body: Option<&'a str>,
|
body: Option<&'a str>,
|
||||||
|
@ -60,6 +49,7 @@ impl<'a> Notification<'a> {
|
||||||
self.icon = Some(icon);
|
self.icon = Some(icon);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline(always)]
|
||||||
pub fn show(&self) -> crate::Result<()> {
|
pub fn show(&self) -> crate::Result<()> {
|
||||||
inner::sendNotification(serde_wasm_bindgen::to_value(&self)?)?;
|
inner::sendNotification(serde_wasm_bindgen::to_value(&self)?)?;
|
||||||
|
|
||||||
|
|
10
src/os.rs
10
src/os.rs
|
@ -61,30 +61,40 @@ pub enum OsKind {
|
||||||
WindowsNt,
|
WindowsNt,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns the operating system CPU architecture for which the tauri app was compiled.
|
||||||
|
#[inline(always)]
|
||||||
pub async fn arch() -> crate::Result<Arch> {
|
pub async fn arch() -> crate::Result<Arch> {
|
||||||
let raw = inner::arch().await?;
|
let raw = inner::arch().await?;
|
||||||
|
|
||||||
Ok(serde_wasm_bindgen::from_value(raw)?)
|
Ok(serde_wasm_bindgen::from_value(raw)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns a string identifying the operating system platform. The value is set at compile time.
|
||||||
|
#[inline(always)]
|
||||||
pub async fn platform() -> crate::Result<Platform> {
|
pub async fn platform() -> crate::Result<Platform> {
|
||||||
let raw = inner::platform().await?;
|
let raw = inner::platform().await?;
|
||||||
|
|
||||||
Ok(serde_wasm_bindgen::from_value(raw)?)
|
Ok(serde_wasm_bindgen::from_value(raw)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns the operating system's default directory for temporary files.
|
||||||
|
#[inline(always)]
|
||||||
pub async fn tempdir() -> crate::Result<PathBuf> {
|
pub async fn tempdir() -> crate::Result<PathBuf> {
|
||||||
let raw = inner::tempdir().await?;
|
let raw = inner::tempdir().await?;
|
||||||
|
|
||||||
Ok(serde_wasm_bindgen::from_value(raw)?)
|
Ok(serde_wasm_bindgen::from_value(raw)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns 'OsKind::Linux' on Linux, 'OsKind::Darwin' on macOS, and 'OsKind::WindowsNT' on Windows.
|
||||||
|
#[inline(always)]
|
||||||
pub async fn kind() -> crate::Result<OsKind> {
|
pub async fn kind() -> crate::Result<OsKind> {
|
||||||
let raw = inner::kind().await?;
|
let raw = inner::kind().await?;
|
||||||
|
|
||||||
Ok(serde_wasm_bindgen::from_value(raw)?)
|
Ok(serde_wasm_bindgen::from_value(raw)?)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Returns a string identifying the kernel version.
|
||||||
|
#[inline(always)]
|
||||||
pub async fn version() -> crate::Result<String> {
|
pub async fn version() -> crate::Result<String> {
|
||||||
let raw = inner::version().await?;
|
let raw = inner::version().await?;
|
||||||
|
|
||||||
|
|
30
src/path.rs
30
src/path.rs
|
@ -14,6 +14,7 @@ use wasm_bindgen::JsValue;
|
||||||
/// # Ok(())
|
/// # Ok(())
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
|
#[inline(always)]
|
||||||
pub async fn app_config_dir() -> crate::Result<PathBuf> {
|
pub async fn app_config_dir() -> crate::Result<PathBuf> {
|
||||||
let raw = inner::appConfigDir().await?;
|
let raw = inner::appConfigDir().await?;
|
||||||
|
|
||||||
|
@ -33,6 +34,7 @@ pub async fn app_config_dir() -> crate::Result<PathBuf> {
|
||||||
/// # Ok(())
|
/// # Ok(())
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
|
#[inline(always)]
|
||||||
pub async fn app_data_dir() -> crate::Result<PathBuf> {
|
pub async fn app_data_dir() -> crate::Result<PathBuf> {
|
||||||
let raw = inner::appDataDir().await?;
|
let raw = inner::appDataDir().await?;
|
||||||
|
|
||||||
|
@ -52,6 +54,7 @@ pub async fn app_data_dir() -> crate::Result<PathBuf> {
|
||||||
/// # Ok(())
|
/// # Ok(())
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
|
#[inline(always)]
|
||||||
pub async fn app_local_data_dir() -> crate::Result<PathBuf> {
|
pub async fn app_local_data_dir() -> crate::Result<PathBuf> {
|
||||||
let raw = inner::appLocalDataDir().await?;
|
let raw = inner::appLocalDataDir().await?;
|
||||||
|
|
||||||
|
@ -71,6 +74,7 @@ pub async fn app_local_data_dir() -> crate::Result<PathBuf> {
|
||||||
/// # Ok(())
|
/// # Ok(())
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
|
#[inline(always)]
|
||||||
pub async fn app_cache_dir() -> crate::Result<PathBuf> {
|
pub async fn app_cache_dir() -> crate::Result<PathBuf> {
|
||||||
let raw = inner::appCacheDir().await?;
|
let raw = inner::appCacheDir().await?;
|
||||||
|
|
||||||
|
@ -95,6 +99,7 @@ pub async fn app_cache_dir() -> crate::Result<PathBuf> {
|
||||||
/// # Ok(())
|
/// # Ok(())
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
|
#[inline(always)]
|
||||||
pub async fn audio_dir() -> crate::Result<PathBuf> {
|
pub async fn audio_dir() -> crate::Result<PathBuf> {
|
||||||
let raw = inner::audioDir().await?;
|
let raw = inner::audioDir().await?;
|
||||||
|
|
||||||
|
@ -119,6 +124,7 @@ pub async fn audio_dir() -> crate::Result<PathBuf> {
|
||||||
/// # Ok(())
|
/// # Ok(())
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
|
#[inline(always)]
|
||||||
pub async fn cache_dir() -> crate::Result<PathBuf> {
|
pub async fn cache_dir() -> crate::Result<PathBuf> {
|
||||||
let raw = inner::cacheDir().await?;
|
let raw = inner::cacheDir().await?;
|
||||||
|
|
||||||
|
@ -143,6 +149,7 @@ pub async fn cache_dir() -> crate::Result<PathBuf> {
|
||||||
/// # Ok(())
|
/// # Ok(())
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
|
#[inline(always)]
|
||||||
pub async fn config_dir() -> crate::Result<PathBuf> {
|
pub async fn config_dir() -> crate::Result<PathBuf> {
|
||||||
let raw = inner::configDir().await?;
|
let raw = inner::configDir().await?;
|
||||||
|
|
||||||
|
@ -167,6 +174,7 @@ pub async fn config_dir() -> crate::Result<PathBuf> {
|
||||||
/// # Ok(())
|
/// # Ok(())
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
|
#[inline(always)]
|
||||||
pub async fn data_dir() -> crate::Result<PathBuf> {
|
pub async fn data_dir() -> crate::Result<PathBuf> {
|
||||||
let raw = inner::dataDir().await?;
|
let raw = inner::dataDir().await?;
|
||||||
|
|
||||||
|
@ -191,6 +199,7 @@ pub async fn data_dir() -> crate::Result<PathBuf> {
|
||||||
/// # Ok(())
|
/// # Ok(())
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
|
#[inline(always)]
|
||||||
pub async fn desktop_dir() -> crate::Result<PathBuf> {
|
pub async fn desktop_dir() -> crate::Result<PathBuf> {
|
||||||
let raw = inner::desktopDir().await?;
|
let raw = inner::desktopDir().await?;
|
||||||
|
|
||||||
|
@ -215,6 +224,7 @@ pub async fn desktop_dir() -> crate::Result<PathBuf> {
|
||||||
/// # Ok(())
|
/// # Ok(())
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
|
#[inline(always)]
|
||||||
pub async fn document_dir() -> crate::Result<PathBuf> {
|
pub async fn document_dir() -> crate::Result<PathBuf> {
|
||||||
let raw = inner::documentDir().await?;
|
let raw = inner::documentDir().await?;
|
||||||
|
|
||||||
|
@ -239,6 +249,7 @@ pub async fn document_dir() -> crate::Result<PathBuf> {
|
||||||
/// # Ok(())
|
/// # Ok(())
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
|
#[inline(always)]
|
||||||
pub async fn download_dir() -> crate::Result<PathBuf> {
|
pub async fn download_dir() -> crate::Result<PathBuf> {
|
||||||
let raw = inner::downloadDir().await?;
|
let raw = inner::downloadDir().await?;
|
||||||
|
|
||||||
|
@ -263,6 +274,7 @@ pub async fn download_dir() -> crate::Result<PathBuf> {
|
||||||
/// # Ok(())
|
/// # Ok(())
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
|
#[inline(always)]
|
||||||
pub async fn executable_dir() -> crate::Result<PathBuf> {
|
pub async fn executable_dir() -> crate::Result<PathBuf> {
|
||||||
let raw = inner::executableDir().await?;
|
let raw = inner::executableDir().await?;
|
||||||
|
|
||||||
|
@ -287,6 +299,7 @@ pub async fn executable_dir() -> crate::Result<PathBuf> {
|
||||||
/// # Ok(())
|
/// # Ok(())
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
|
#[inline(always)]
|
||||||
pub async fn font_dir() -> crate::Result<PathBuf> {
|
pub async fn font_dir() -> crate::Result<PathBuf> {
|
||||||
let raw = inner::fontDir().await?;
|
let raw = inner::fontDir().await?;
|
||||||
|
|
||||||
|
@ -311,6 +324,7 @@ pub async fn font_dir() -> crate::Result<PathBuf> {
|
||||||
/// # Ok(())
|
/// # Ok(())
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
|
#[inline(always)]
|
||||||
pub async fn home_dir() -> crate::Result<PathBuf> {
|
pub async fn home_dir() -> crate::Result<PathBuf> {
|
||||||
let raw = inner::homeDir().await?;
|
let raw = inner::homeDir().await?;
|
||||||
|
|
||||||
|
@ -335,6 +349,7 @@ pub async fn home_dir() -> crate::Result<PathBuf> {
|
||||||
/// # Ok(())
|
/// # Ok(())
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
|
#[inline(always)]
|
||||||
pub async fn local_data_dir() -> crate::Result<PathBuf> {
|
pub async fn local_data_dir() -> crate::Result<PathBuf> {
|
||||||
let raw = inner::localDataDir().await?;
|
let raw = inner::localDataDir().await?;
|
||||||
|
|
||||||
|
@ -359,6 +374,7 @@ pub async fn local_data_dir() -> crate::Result<PathBuf> {
|
||||||
/// # Ok(())
|
/// # Ok(())
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
|
#[inline(always)]
|
||||||
pub async fn picture_dir() -> crate::Result<PathBuf> {
|
pub async fn picture_dir() -> crate::Result<PathBuf> {
|
||||||
let raw = inner::pictureDir().await?;
|
let raw = inner::pictureDir().await?;
|
||||||
|
|
||||||
|
@ -383,6 +399,7 @@ pub async fn picture_dir() -> crate::Result<PathBuf> {
|
||||||
/// # Ok(())
|
/// # Ok(())
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
|
#[inline(always)]
|
||||||
pub async fn public_dir() -> crate::Result<PathBuf> {
|
pub async fn public_dir() -> crate::Result<PathBuf> {
|
||||||
let raw = inner::publicDir().await?;
|
let raw = inner::publicDir().await?;
|
||||||
|
|
||||||
|
@ -402,6 +419,7 @@ pub async fn public_dir() -> crate::Result<PathBuf> {
|
||||||
/// # Ok(())
|
/// # Ok(())
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
|
#[inline(always)]
|
||||||
pub async fn resource_dir() -> crate::Result<PathBuf> {
|
pub async fn resource_dir() -> crate::Result<PathBuf> {
|
||||||
let raw = inner::resourceDir().await?;
|
let raw = inner::resourceDir().await?;
|
||||||
|
|
||||||
|
@ -422,6 +440,7 @@ pub async fn resource_dir() -> crate::Result<PathBuf> {
|
||||||
/// # Ok(())
|
/// # Ok(())
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
|
#[inline(always)]
|
||||||
pub async fn resolve_resource(resource_path: &str) -> crate::Result<PathBuf> {
|
pub async fn resolve_resource(resource_path: &str) -> crate::Result<PathBuf> {
|
||||||
let raw = inner::resolveResource(JsValue::from_str(resource_path)).await?;
|
let raw = inner::resolveResource(JsValue::from_str(resource_path)).await?;
|
||||||
|
|
||||||
|
@ -446,6 +465,7 @@ pub async fn resolve_resource(resource_path: &str) -> crate::Result<PathBuf> {
|
||||||
/// # Ok(())
|
/// # Ok(())
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
|
#[inline(always)]
|
||||||
pub async fn runtime_dir() -> crate::Result<PathBuf> {
|
pub async fn runtime_dir() -> crate::Result<PathBuf> {
|
||||||
let raw = inner::runtimeDir().await?;
|
let raw = inner::runtimeDir().await?;
|
||||||
|
|
||||||
|
@ -470,6 +490,7 @@ pub async fn runtime_dir() -> crate::Result<PathBuf> {
|
||||||
/// # Ok(())
|
/// # Ok(())
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
|
#[inline(always)]
|
||||||
pub async fn template_dir() -> crate::Result<PathBuf> {
|
pub async fn template_dir() -> crate::Result<PathBuf> {
|
||||||
let raw = inner::templateDir().await?;
|
let raw = inner::templateDir().await?;
|
||||||
|
|
||||||
|
@ -494,6 +515,7 @@ pub async fn template_dir() -> crate::Result<PathBuf> {
|
||||||
/// # Ok(())
|
/// # Ok(())
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
|
#[inline(always)]
|
||||||
pub async fn video_dir() -> crate::Result<PathBuf> {
|
pub async fn video_dir() -> crate::Result<PathBuf> {
|
||||||
let raw = inner::videoDir().await?;
|
let raw = inner::videoDir().await?;
|
||||||
|
|
||||||
|
@ -518,6 +540,7 @@ pub async fn video_dir() -> crate::Result<PathBuf> {
|
||||||
/// # Ok(())
|
/// # Ok(())
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
|
#[inline(always)]
|
||||||
pub async fn app_log_dir() -> crate::Result<PathBuf> {
|
pub async fn app_log_dir() -> crate::Result<PathBuf> {
|
||||||
let raw = inner::appLogDir().await?;
|
let raw = inner::appLogDir().await?;
|
||||||
|
|
||||||
|
@ -538,6 +561,7 @@ pub async fn app_log_dir() -> crate::Result<PathBuf> {
|
||||||
/// # Ok(())
|
/// # Ok(())
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
|
#[inline(always)]
|
||||||
pub async fn resolve(paths: impl IntoIterator<Item = &str>) -> crate::Result<PathBuf> {
|
pub async fn resolve(paths: impl IntoIterator<Item = &str>) -> crate::Result<PathBuf> {
|
||||||
let paths = paths.into_iter();
|
let paths = paths.into_iter();
|
||||||
let raw = inner::resolve(serde_wasm_bindgen::to_value(&paths.collect::<Vec<_>>())?).await?;
|
let raw = inner::resolve(serde_wasm_bindgen::to_value(&paths.collect::<Vec<_>>())?).await?;
|
||||||
|
@ -559,6 +583,7 @@ pub async fn resolve(paths: impl IntoIterator<Item = &str>) -> crate::Result<Pat
|
||||||
/// # Ok(())
|
/// # Ok(())
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
|
#[inline(always)]
|
||||||
pub async fn normalize(path: &str) -> crate::Result<PathBuf> {
|
pub async fn normalize(path: &str) -> crate::Result<PathBuf> {
|
||||||
let raw = inner::normalize(JsValue::from_str(path)).await?;
|
let raw = inner::normalize(JsValue::from_str(path)).await?;
|
||||||
|
|
||||||
|
@ -579,6 +604,7 @@ pub async fn normalize(path: &str) -> crate::Result<PathBuf> {
|
||||||
/// # Ok(())
|
/// # Ok(())
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
|
#[inline(always)]
|
||||||
pub async fn join(paths: impl IntoIterator<Item = &str>) -> crate::Result<PathBuf> {
|
pub async fn join(paths: impl IntoIterator<Item = &str>) -> crate::Result<PathBuf> {
|
||||||
let paths = paths.into_iter();
|
let paths = paths.into_iter();
|
||||||
let raw = inner::join(serde_wasm_bindgen::to_value(&paths.collect::<Vec<_>>())?).await?;
|
let raw = inner::join(serde_wasm_bindgen::to_value(&paths.collect::<Vec<_>>())?).await?;
|
||||||
|
@ -600,6 +626,7 @@ pub async fn join(paths: impl IntoIterator<Item = &str>) -> crate::Result<PathBu
|
||||||
/// # Ok(())
|
/// # Ok(())
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
|
#[inline(always)]
|
||||||
pub async fn dirname(path: &str) -> crate::Result<PathBuf> {
|
pub async fn dirname(path: &str) -> crate::Result<PathBuf> {
|
||||||
let raw = inner::dirname(JsValue::from_str(path)).await?;
|
let raw = inner::dirname(JsValue::from_str(path)).await?;
|
||||||
|
|
||||||
|
@ -620,6 +647,7 @@ pub async fn dirname(path: &str) -> crate::Result<PathBuf> {
|
||||||
/// # Ok(())
|
/// # Ok(())
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
|
#[inline(always)]
|
||||||
pub async fn extname(path: &str) -> crate::Result<PathBuf> {
|
pub async fn extname(path: &str) -> crate::Result<PathBuf> {
|
||||||
let raw = inner::extname(JsValue::from_str(path)).await?;
|
let raw = inner::extname(JsValue::from_str(path)).await?;
|
||||||
|
|
||||||
|
@ -642,6 +670,7 @@ pub async fn extname(path: &str) -> crate::Result<PathBuf> {
|
||||||
/// # Ok(())
|
/// # Ok(())
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
|
#[inline(always)]
|
||||||
pub async fn basename(path: &str, ext: Option<&str>) -> crate::Result<PathBuf> {
|
pub async fn basename(path: &str, ext: Option<&str>) -> crate::Result<PathBuf> {
|
||||||
let raw = inner::basename(
|
let raw = inner::basename(
|
||||||
JsValue::from_str(path),
|
JsValue::from_str(path),
|
||||||
|
@ -664,6 +693,7 @@ pub async fn basename(path: &str, ext: Option<&str>) -> crate::Result<PathBuf> {
|
||||||
/// # Ok(())
|
/// # Ok(())
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
|
#[inline(always)]
|
||||||
pub async fn is_absolute(path: &str) -> crate::Result<bool> {
|
pub async fn is_absolute(path: &str) -> crate::Result<bool> {
|
||||||
let raw = inner::isAbsolute(JsValue::from_str(path)).await?;
|
let raw = inner::isAbsolute(JsValue::from_str(path)).await?;
|
||||||
|
|
||||||
|
|
|
@ -1,8 +1,10 @@
|
||||||
|
#[inline(always)]
|
||||||
pub async fn exit(exit_code: u32) -> ! {
|
pub async fn exit(exit_code: u32) -> ! {
|
||||||
inner::exit(exit_code).await;
|
inner::exit(exit_code).await;
|
||||||
unreachable!()
|
unreachable!()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#[inline(always)]
|
||||||
pub fn relaunch() {
|
pub fn relaunch() {
|
||||||
inner::relaunch();
|
inner::relaunch();
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,6 +43,7 @@ pub enum UpdateStatus {
|
||||||
/// # Ok(())
|
/// # Ok(())
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
|
#[inline(always)]
|
||||||
pub async fn check_update() -> crate::Result<UpdateResult> {
|
pub async fn check_update() -> crate::Result<UpdateResult> {
|
||||||
let raw = inner::checkUpdate().await?;
|
let raw = inner::checkUpdate().await?;
|
||||||
|
|
||||||
|
@ -66,6 +67,7 @@ pub async fn check_update() -> crate::Result<UpdateResult> {
|
||||||
/// # Ok(())
|
/// # Ok(())
|
||||||
/// # }
|
/// # }
|
||||||
/// ```
|
/// ```
|
||||||
|
#[inline(always)]
|
||||||
pub async fn install_update() -> crate::Result<()> {
|
pub async fn install_update() -> crate::Result<()> {
|
||||||
inner::installUpdate().await?;
|
inner::installUpdate().await?;
|
||||||
Ok(())
|
Ok(())
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue