Skip to main content

Module plugin_data

Module plugin_data 

Source
Expand description

Where a plugin keeps files of its own, by how long they live: PluginData, in every run. A plugin names its files under its own name, such as vim/registers.json.

use rig_harness::prelude::*;

fn save(data: Res<PluginData>) -> std::io::Result<()> {
    // Kept with the session.
    data.session.write_file("vim/registers.json", b"{}")?;
    // This project's, whichever session works in it.
    data.project.write_file("vim/marks.json", b"{}")?;
    // Every session's.
    data.user.write_file("vim/mode.json", b"\"normal\"")
}

Structs§

PluginData
Where plugins keep their files: per session, per project and per user. Not in the project’s own directory: a plugin’s data is the user’s, never committed and never read from a checkout someone else made. Inserted once every plugin is built, in every run, unless the app has one: a run without a saved session keeps session in memory.