openslide-rs 2.4.0

Rust bindings of OpenSlide C library
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
use crate::{Result, bindings};

#[derive(Debug)]
pub(crate) struct Cache(pub(crate) bindings::CacheWrapper);

impl Drop for Cache {
    fn drop(&mut self) {
        bindings::cache_release(*self.0);
    }
}

impl Cache {
    /// Create a new cache with the given capacity
    pub fn new(capacity: usize) -> Result<Cache> {
        let cache = bindings::CacheWrapper(bindings::cache_create(capacity)?);
        Ok(Cache(cache))
    }
}