Function rusty_spine::extension::set_read_file_cb

source ·
pub fn set_read_file_cb<F>(read_file_cb: F)
where F: Fn(&str) -> Option<Vec<u8>> + 'static,
Expand description

Set _spUtil_readFile

Can be used to customize file loading when using functions which read files from disk. This callback is largely unnecessary as its possible to avoid calling these sorts of functions if read-from-disk is not desirable. Additionally, a default implementation using Rust’s std::fs::read is provided if this callback remains unset.

rusty_spine::extension::set_read_file_cb(|path| {
    std::fs::read(path).ok()
});

§Panics

Panics if the internal mutex is poisoned.