postscriptum 0.1.0

Multi-interpreted-language scripting engine for Rust with Rhai and Python backends
Documentation
//! Error types for postscriptum.
//!
//! All public fallible APIs return [`Result`] / [`Error`], so consumers can
//! match on the failure cause instead of a crate-specific opaque error.

use std::ffi::NulError;

/// The `Result` type used across postscriptum.
pub type Result<T> = std::result::Result<T, Error>;

/// The error type returned by postscriptum.
#[derive(Debug, thiserror::Error)]
pub enum Error {
    /// The engine mutex was poisoned (a thread panicked while it was locked).
    #[error("engine mutex poisoned")]
    MutexPoisoned,

    /// The Rhai engine reported an error while evaluating a script.
    #[error("rhai error: {0}")]
    Rhai(String),

    /// The Python engine reported an error while evaluating a script or
    /// registering functions.
    #[error("python error: {0}")]
    Python(String),

    /// A function name could not be converted to a C string.
    #[error("invalid function name: {0}")]
    FunctionName(#[from] NulError),
}