include-pnm 1.0.0

Include PNM images directly in Rust code.
Documentation
//! Error state functions.
use std::{fmt, path::Path};

use proc_macro::Span;

/// Error when a token is invalid.
#[cold]
pub(crate) fn expected_token(caller: &str, expected: &str, span: Span) -> ! {
    panic!("expected {expected} argument to {caller} at {span:?}")
}

/// Error when there are extra tokens.
#[cold]
pub(crate) fn extraneous_token(caller: &str, span: Span) -> ! {
    panic!("extraneous input to {caller} at {span:?}")
}

/// Error when file couldn't be parsed.
#[cold]
pub(crate) fn io_failure(operation: &str, path: &Path, e: &dyn fmt::Display) -> ! {
    panic!("couldn't {operation} {}: {e}", path.display())
}