use core::{
    error::Error,
    fmt::{self, Display},
};

/// Errors that can occur upon type checking function signatures.
#[derive(Debug)]
pub enum FuncError {
    /// The exported function could not be found.
    ExportedFuncNotFound,
    /// A function parameter did not match the required type.
    MismatchingParameterType,
    /// Specified an incorrect number of parameters.
    MismatchingParameterLen,
    /// A function result did not match the required type.
    MismatchingResultType,
    /// Specified an incorrect number of results.
    MismatchingResultLen,
}

impl Error for FuncError {}

impl Display for FuncError {
    fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
        match self {
            FuncError::ExportedFuncNotFound => {
                write!(f, "could not find exported function")
            }
            FuncError::MismatchingParameterType => {
                write!(f, "encountered incorrect function parameter type")
            }
            FuncError::MismatchingParameterLen => {
                write!(f, "encountered an incorrect number of parameters")
            }
            FuncError::MismatchingResultType => {
                write!(f, "encountered incorrect function result type")
            }
            FuncError::MismatchingResultLen => {
                write!(f, "encountered an incorrect number of results")
            }
        }
    }
}

Homonyms

soft3/mir/src/error.rs
soft3/tru/rs/error.rs
warriors/trisha/cli/error.rs
neural/rs/darwin-sys/src/error.rs
soft3/radio/iroh-car/src/error.rs
soft3/radio/iroh-ffi/src/error.rs
cyb/prysm/molecules/rs/error.rs
soft3/radio/cyber-bao/src/io/error.rs
soft3/radio/iroh-willow/src/session/error.rs
cyb/evy/forks/naga/src/error.rs
cyb/wysm/crates/fuzz/src/error.rs
cyb/evy/crates/evy_engine_tasks/src/error.rs
soft3/radio/iroh-dns-server/src/http/error.rs
cyb/wysm/crates/ir/src/error.rs
soft3/radio/iroh-blobs/src/get/error.rs
cyb/wysm/crates/c_api/src/error.rs
cyb/wysm/crates/wasmi/src/error.rs
cyb/evy/crates/evy_engine_dispatch/src/error.rs
cyb/wysm/crates/core/src/table/error.rs
bootloader/go-cyber/cw/contracts/graph-filter/src/error.rs
cyb/wysm/crates/collections/src/arena/error.rs
cyb/wysm/crates/core/src/memory/error.rs
cyb/evy/forks/bevy_ecs/src/schedule/error.rs
bootloader/go-cyber/cw/contracts/std-test/src/error.rs
cyb/evy/forks/bevy_ecs/src/world/error.rs
cyb/evy/forks/bevy_ecs/src/query/error.rs
cyb/wysm/crates/wasmi/src/store/error.rs
cyb/evy/forks/naga/src/front/wgsl/error.rs
cyb/evy/forks/naga/src/front/spv/error.rs
cyb/wysm/crates/wasmi/src/engine/translator/error.rs
cyb/evy/forks/naga/src/front/glsl/error.rs
cyb/wysm/crates/wasmi/src/module/instantiate/error.rs

Graph