Module cache

Source
Expand description

Caching utilities for Duat

The cache in Duat is used when restoring previous information from a previous Duat instance, or when reloading Duat’s configuration crate.

One example for where this is used is the Ui, which has information about how much a given file should be scrolled when opening it in Duat. Another example is Cursors, which stores a list of open Cursors, to start the file on.

Plugins are able to cache any type that implements [Serialize] and [Deserialize]. Duat provides these traits from [serde], but in order to derive them, you will need a small addition on the declaration of the type:

#[derive(Deserialize, Serialize)]
#[serde(crate = "duat_core::cache::serde")]
enum MyCacheableEnum {
    // ...
}

Re-exports§

pub use bincode;