pub struct FileHandler;Implementations§
Source§impl FileHandler
impl FileHandler
Sourcepub fn save<T: Serialize>(
data: &[T],
format: &FileFormat,
filename_prefix: &str,
) -> Result<String>
pub fn save<T: Serialize>( data: &[T], format: &FileFormat, filename_prefix: &str, ) -> Result<String>
Save data to a file in the data directory.
§Arguments
data- Data to saveformat- File format to save asfilename_prefix- Prefix for the filename
§Errors
std::io::Error- If the file cannot be opened or written toserde_json::Error- If the JSON cannot be serialized
§Returns
Result<String>- Filename of the saved file
Sourcepub fn append<T: Serialize + for<'de> Deserialize<'de> + Clone>(
data: &[T],
file_path: &str,
) -> Result<String>
pub fn append<T: Serialize + for<'de> Deserialize<'de> + Clone>( data: &[T], file_path: &str, ) -> Result<String>
Append data to an existing file.
§Arguments
data- Data to appendfile_path- Path to the file to append to
§Returns
Result<String>- Path of the updated file
Append data to an existing file.
§Arguments
data- Data to appendfile_path- Path to the file to append to
§Errors
std::io::Error- If an I/O error occurs
§Returns
Result<String>- Path of the updated file
Auto Trait Implementations§
impl Freeze for FileHandler
impl RefUnwindSafe for FileHandler
impl Send for FileHandler
impl Sync for FileHandler
impl Unpin for FileHandler
impl UnwindSafe for FileHandler
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more