#[cfg(not(creusot))]
pub mod input_string;
mod parse_error;
#[cfg(not(creusot))]
pub use input_string::InputString;
#[doc(hidden)]
#[cfg(feature = "std")]
pub trait ErrorExt: std::error::Error + 'static {
#[inline(always)]
fn check_is_actually_error_source(&self) {}
}
#[doc(hidden)]
#[cfg(feature = "std")]
impl<T: std::error::Error + 'static> ErrorExt for T {}
#[macro_export]
macro_rules! write_err {
($writer:expr, $string:literal $(, $args:expr)*; $source:expr) => {
{
#[cfg(feature = "std")]
{
use $crate::error::ErrorExt;
($source).check_is_actually_error_source();
write!($writer, $string $(, $args)*)
}
#[cfg(not(feature = "std"))]
{
write!($writer, concat!($string, ": {}") $(, $args)*, $source)
}
}
}
}
#[macro_export]
macro_rules! write_err_unchecked_source {
($writer:expr, $string:literal $(, $args:expr)*; $source:expr) => {
{
#[cfg(feature = "std")]
{
let _ = &$source;
write!($writer, $string $(, $args)*)
}
#[cfg(not(feature = "std"))]
{
write!($writer, concat!($string, ": {}") $(, $args)*, $source)
}
}
}
}