PrivateStorage

Struct PrivateStorage 

Source
pub struct PrivateStorage<'a, R: Runtime> { /* private fields */ }
Expand description

API of file storage intended for the app’s use only.

§Examples

fn example(app: &tauri::AppHandle) {
    use tauri_plugin_android_fs::AndroidFsExt as _;
 
    let api = app.android_fs();
    let private_storage = api.private_storage();
}

Implementations§

Source§

impl<'a, R: Runtime> AsyncPrivateStorage<'a, R>

Source

pub async fn resolve_path(&self, dir: PrivateDir) -> Result<PathBuf>

Get an absolute path of the app-specific directory on the internal storage.
App can fully manage entries within this directory.

This function does not create any directories; it only constructs the path.

Since these locations may contain files created by other Tauri plugins or webview systems, it is recommended to add a subdirectory with a unique name.

These entries will be deleted when the app is uninstalled and may also be deleted at the user’s initialising request.

When using PrivateDir::Cache, the system will automatically delete entries as disk space is needed elsewhere on the device. But you should not rely on this. The cache should be explicitly cleared by yourself.

The system prevents other apps and user from accessing these locations. In cases where the device is rooted or the user has special permissions, the user may be able to access this.

Since the returned paths can change when the app is moved to an adopted storage, only relative paths should be stored.

§Note

This provides a separate area for each user in a multi-user environment.

§Support

All Android version.

Source

pub async fn resolve_outside_path( &self, volume_id: Option<&StorageVolumeId>, dir: OutsidePrivateDir, ) -> Result<PathBuf>

👎Deprecated: Use AppStorage::resolve_path instead
Source

pub async fn get_volumes(&self) -> Result<Vec<StorageVolume>>

👎Deprecated: Use AppStorage::get_volumes instead
Source

pub async fn get_primary_volume(&self) -> Result<Option<StorageVolume>>

👎Deprecated: Use AppStorage::get_primary_volume instead
Source

pub async fn resolve_uri( &self, dir: PrivateDir, relative_path: impl AsRef<Path>, ) -> Result<FileUri>

👎Deprecated: use FileUri::from_path instead

This is same as FileUri::from_path

Auto Trait Implementations§

§

impl<'a, R> Freeze for AsyncPrivateStorage<'a, R>

§

impl<'a, R> RefUnwindSafe for AsyncPrivateStorage<'a, R>

§

impl<'a, R> Send for AsyncPrivateStorage<'a, R>

§

impl<'a, R> Sync for AsyncPrivateStorage<'a, R>

§

impl<'a, R> Unpin for AsyncPrivateStorage<'a, R>

§

impl<'a, R> UnwindSafe for AsyncPrivateStorage<'a, R>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> ErasedDestructor for T
where T: 'static,