tui_markup/generator/helper/
error.rs1use std::{
2 error::Error,
3 fmt::{Debug, Display},
4};
5
6use crate::LocatedError;
7
8#[derive(Copy, Clone, PartialEq, Eq)]
12pub struct GeneratorInfallible;
13
14impl GeneratorInfallible {
15 fn panic() -> ! {
16 panic!("infallible generator emitted a error, please report this as bug")
17 }
18}
19
20impl Debug for GeneratorInfallible {
21 fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
22 GeneratorInfallible::panic()
23 }
24}
25
26impl Display for GeneratorInfallible {
27 fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
28 GeneratorInfallible::panic()
29 }
30}
31
32impl Error for GeneratorInfallible {}
33
34impl LocatedError for GeneratorInfallible {
35 fn location(&self) -> (usize, usize) {
36 GeneratorInfallible::panic()
37 }
38}
39
40impl<'a> From<GeneratorInfallible> for crate::Error<'a, GeneratorInfallible> {
41 fn from(_e: GeneratorInfallible) -> Self {
42 GeneratorInfallible::panic()
43 }
44}