tauri_plugin_android_fs/impls/
mod.rs

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