pub struct FileProvider { /* private fields */ }
Expand description
The FileProvider is the primary method of retrieving raw data from the cache.
In order to function correctly, an index, archive and file ID must be supplied.
The index is type usize
, and the archive and file ID can either be a u32 reference (&u32
) or a String reference (&String
).
use idx::util::FileProvider;
use idx::util::CacheBuilder;
let cache = CacheBuilder::new()
.with_path("test_cache")
.build();
let mut data_provider = FileProvider::from(&cache);
data_provider.index(19).archive(&6);
let data = data_provider.request(&17); //Returns the raw data for file 17 in archive 6 of index 19.
assert_ne!(0, data.len());
Implementations§
Source§impl FileProvider
impl FileProvider
pub fn from(cache: &Arc<Mutex<Cache>>) -> Self
pub fn index(&mut self, index: u32) -> &mut Self
pub fn archive(&mut self, archive: &dyn ContainerIdProvider) -> &mut Self
pub fn with_keys(&mut self, keys: Vec<i64>)
pub fn request(&mut self, file: &dyn ContainerIdProvider) -> DataBuffer
Auto Trait Implementations§
impl Freeze for FileProvider
impl RefUnwindSafe for FileProvider
impl Send for FileProvider
impl Sync for FileProvider
impl Unpin for FileProvider
impl UnwindSafe for FileProvider
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