Function polars_core::toggle_string_cache
source · pub fn toggle_string_cache(toggle: bool)Expand description
Use a global string cache for the Categorical Types.
This is used to cache the string categories locally. This allows join operations on categorical types.
Examples found in repository?
src/chunked_array/logical/categorical/stringcache.rs (line 35)
34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51
pub fn new() -> IUseStringCache {
toggle_string_cache(true);
IUseStringCache { private_zst: () }
}
}
impl Drop for IUseStringCache {
fn drop(&mut self) {
toggle_string_cache(false)
}
}
pub fn with_string_cache<F: FnOnce() -> T, T>(func: F) -> T {
toggle_string_cache(true);
let out = func();
toggle_string_cache(false);
out
}