tauri_plugin_android_fs/impls/
mod.rs1#[cfg(target_os = "android")]
2mod android;
3
4#[cfg(target_os = "android")]
5use android::AndroidFsImpl;
6
7#[cfg(not(target_os = "android"))]
8mod other;
9#[cfg(not(target_os = "android"))]
10use other::AndroidFsImpl;
11
12use crate::AndroidFs;
13use tauri::{plugin::{Builder, TauriPlugin}, Manager, Runtime};
14
15
16pub fn init<R: Runtime>() -> TauriPlugin<R> {
18 Builder::new("android-fs")
19 .setup(|app, api| {
20 app.manage(AndroidFsImpl::new(app, api)?);
21 Ok(())
22 })
23 .build()
24}
25
26pub trait AndroidFsExt<R: Runtime> {
27
28 fn android_fs(&self) -> &impl AndroidFs;
29}
30
31impl<R: Runtime, T: Manager<R>> AndroidFsExt<R> for T {
32
33 fn android_fs(&self) -> &impl AndroidFs {
34 self.state::<AndroidFsImpl<R>>().inner()
35 }
36}