[Add] basic split

This commit is contained in:
Alex Emmet 2026-04-04 19:46:21 +02:00
commit 3cdf7c62d5
77 changed files with 506 additions and 648 deletions

View file

@ -0,0 +1,49 @@
use std::fmt::{Debug, Formatter};
use std::future::Future;
use std::pin::Pin;
use crate::screens::screens::Screen;
#[allow(unused)]
pub enum InteractionResult {
CloseScreen,
OpenScreen {
screen: Box<dyn Screen>,
},
OpenFutureScreen {
screen: Pin<Box<dyn Future<Output = Box<dyn Screen>> + Send>>,
},
Handled,
Unhandled,
}
impl Debug for InteractionResult {
fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
match self {
InteractionResult::OpenScreen { screen: _ } => write!(f, "OpenScreen"),
InteractionResult::OpenFutureScreen { screen: _ } => write!(f, "OpenFutureScreen"),
InteractionResult::CloseScreen => write!(f, "CloseScreen"),
InteractionResult::Handled => write!(f, "Handled"),
InteractionResult::Unhandled => write!(f, "Unhandled"),
}
}
}
impl PartialEq for InteractionResult {
fn eq(&self, other: &Self) -> bool {
match (self, other) {
(
InteractionResult::OpenScreen { screen: _ },
InteractionResult::OpenScreen { screen: _ },
) => true,
(
InteractionResult::OpenFutureScreen { screen: _ },
InteractionResult::OpenFutureScreen { screen: _ },
) => true,
(InteractionResult::CloseScreen, InteractionResult::CloseScreen) => true,
(InteractionResult::Handled, InteractionResult::Handled) => true,
(InteractionResult::Unhandled, InteractionResult::Unhandled) => true,
_ => false,
}
}
}