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)]
13pub struct GeneratorInfallible;
14
15impl GeneratorInfallible {
16 fn panic() -> ! {
17 panic!("infallible generator emitted a error, please report this as bug")
18 }
19}
20
21impl Debug for GeneratorInfallible {
22 fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
23 GeneratorInfallible::panic()
24 }
25}
26
27impl Display for GeneratorInfallible {
28 fn fmt(&self, _f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
29 GeneratorInfallible::panic()
30 }
31}
32
33impl Error for GeneratorInfallible {}
34
35impl LocatedError for GeneratorInfallible {
36 fn location(&self) -> (usize, usize) {
37 GeneratorInfallible::panic()
38 }
39}
40
41impl From<GeneratorInfallible> for crate::Error<'_, GeneratorInfallible> {
42 fn from(_e: GeneratorInfallible) -> Self {
43 GeneratorInfallible::panic()
44 }
45}