oxzy-lib 3.0.1

Your oxidised fuzzer lib!
Documentation
use serde::{Deserialize, Serialize};
use std::path::PathBuf;

// ##### init #####

/// Directories a plugin is supposed to use for configuration and data caching.
#[derive(Debug, Serialize, Deserialize)]
pub struct PluginInitDirs {
    /// Path to a directory where the plugin will find its config.
    /// This typically includes a `config.json` and further required files.
    ///
    /// This directory can be read-only.
    pub config: PathBuf,

    /// Path to a directory where the plugin is allowed to write data for caching.
    ///
    /// This directory needs to be read-and-write.
    pub cache: PathBuf,
}

/// Metadata returned by a plugin after initialization.
#[derive(Debug, Serialize, Deserialize)]
pub struct PluginMetadata {
    /// Name of the plugin
    pub name: String,

    /// Description of the plugin
    pub description: String,

    /// Version of the plugin
    pub version: String,
}

// ##### query #####

/// A singular query result, a list of these is returned by calling the query function on a plugin.
#[derive(Debug, Serialize, Deserialize)]
pub struct QueryResult {
    /// Title of the result.
    pub title: String,

    /// Optional description of the result.
    pub description: Option<String>,
}

// ##### handle #####

/// Entry send to a plugins handle function, containing the selected entry and args.
#[derive(Debug, Serialize, Deserialize)]
pub struct HandleEntry {
    /// Query selected by the user
    pub entry: QueryResult,

    /// Optional args passed by the user
    pub args: Vec<String>,
}

/// Result of a plugins handle function, tells the launcher whether it should exit or continue running.
#[derive(Debug, Serialize, Deserialize)]
pub enum HandleResult {
    /// Keep launcher active after calling the handle function
    Continue,

    /// Close the launcher after the call to the handle function
    Exit,
}