Struct persistentcache::storage::file::FileStorage [−][src]
pub struct FileStorage { /* fields omitted */ }
FileStorage
struct
Methods
impl FileStorage
[src]
impl FileStorage
pub fn new(path: &str) -> Result<Self, Error>
[src]
pub fn new(path: &str) -> Result<Self, Error>
Creates the path
directory and returns a FileStorage
struct.
Example
use persistentcache::storage::file::FileStorage; let s = FileStorage::new(".example_dir").unwrap();
Trait Implementations
impl PersistentCache for FileStorage
[src]
impl PersistentCache for FileStorage
fn get(&mut self, name: &str) -> Result<Vec<u8>, Error>
[src]
fn get(&mut self, name: &str) -> Result<Vec<u8>, Error>
Returns the value corresponding to the variable name
.
fn set(&mut self, name: &str, val: &[u8]) -> Result<(), Error>
[src]
fn set(&mut self, name: &str, val: &[u8]) -> Result<(), Error>
Writes the data of type &[u8]
in array val
to the file corresponding to the variable name
.
fn flush(&mut self) -> Result<(), Error>
[src]
fn flush(&mut self) -> Result<(), Error>
Delete all variables stored in path
(see new()
) which start with PREFIX_
.
Auto Trait Implementations
impl Send for FileStorage
impl Send for FileStorage
impl Sync for FileStorage
impl Sync for FileStorage