Skip to main content

ferroui_base/platform/storage/
i_storage_file.rs

1use super::IStorageItem;
2use crate::input::LocalBoxFuture;
3use std::io::{Read, Write};
4
5/// Represents a file. Provides information about the file and its contents,
6/// and ways to manipulate them.
7///
8/// This interface is not meant to be implemented by applications.
9pub trait IStorageFile: IStorageItem {
10    /// Opens a stream for read access.
11    ///
12    /// Fails (among other reasons) when access to the file is denied.
13    fn open_read_async(&self) -> LocalBoxFuture<std::io::Result<Box<dyn Read>>>;
14
15    /// Opens a stream for writing to the file.
16    ///
17    /// Fails (among other reasons) when access to the file is denied.
18    fn open_write_async(&self) -> LocalBoxFuture<std::io::Result<Box<dyn Write>>>;
19}