/// Function to save (temporary) `data` to file named `p` in workflow's cache dir
///
/// This function is provided so that workflow authors can temporarily save information
/// to workflow's cache dir. The saved data is considered to be irrelevant to workflow's
/// actual data (for which you should use [`set`] and [`get`])
///
/// # Example
/// ```rust,no_run
/// # extern crate alfred_rs;
/// use alfred_rs::data::Data;
///
/// Data::save_to_file("cached_tags.dat", &vec!["rust", "alfred"]).unwrap();
/// ```
/// ## Note
/// Only the [`file_name`] portion of `p` will be used to name the file that'll be stored in
/// workflow's cache directory.
/// # Errors
/// File IO related issues as well as serializing problems will cause an error to be returned.
///
/// [`set`]: struct.Data.html#method.set
/// [`get`]: struct.Data.html#method.get
/// [`file_name`]: https://doc.rust-lang.org/std/path/struct.Path.html#method.file_name
Function to save (temporary) `data` to file named `p` in workflow's cache dir
This function is provided so that workflow authors can temporarily save information
to workflow's cache dir. The saved data is considered to be irrelevant to workflow's
actual data (for which you should use [`set`] and [`get`])
Function to save ( temporary ) ` data ` to file named ` p ` in workflow ' s cache dir This function is provided so that workflow authors can temporarily save information to workflow ' s cache dir . The saved data is considered to be irrelevant to workflow ' s actual data ( for which you should use [ ` set ` ] and [ ` get ` ] )
pub fn save_to_file<P, V>(p: P, data: &V) -> Result<(), Error>
    where
        P: AsRef<Path>,
        V: Serialize,
    {
        let filename = p
            .as_ref()
            .file_name()
            .ok_or_else(|| err_msg("invalid file name"))?;
        let p = env::workflow_cache()
            .map(|wfc| wfc.join(filename))
            .ok_or_else(|| {
                err_msg("missing env variable for cache dir. forgot to set workflow bundle id?")
            })?;
        debug!("saving to: {}", p.to_str().expect(""));
        Self::write_data_to_disk(p, data)
    }
pub fn save_to_file < P , V > ( p : P , data : & V ) -> Result < ( ) , Error > where P : AsRef < Path > , V : Serialize , { let filename = p . as_ref ( ) . file_name ( ) . ok_or_else ( | | err_msg ( " " ) ) ? ; let p = env :: workflow_cache ( ) . map ( | wfc | wfc . join ( filename ) ) . ok_or_else ( | | { err_msg ( " " ) } ) ? ; debug ! ( " " p to_str ( ) expect ( " " ) ) ; Self :: write_data_to_disk ( p , data ) }
Function to save (temporary) `data` to file named `p` in workflow's cache dir
This function is provided so that workflow authors can temporarily save information
to workflow's cache dir.
Function to save ( temporary ) ` data ` to file named ` p ` in workflow ' s cache dir This function is provided so that workflow authors can temporarily save information to workflow ' s cache dir .
p
P
data
&V
example
None
extern crate alfred_rs;
None
note
Only the [`file_name`] portion of `p` will be used to name the file that'll be stored in
workflow's cache directory.
Only the [ ` file_name ` ] portion of ` p ` will be used to name the file that ' ll be stored in workflow ' s cache directory .
errors
File IO related issues as well as serializing problems will cause an error to be returned.


File IO related issues as well as serializing problems will cause an error to be returned .