wip: refactor(tengri): routines!

This commit is contained in:
same mf who else 2026-03-09 02:06:30 +02:00
parent 8f0a2accce
commit 4e8d58d793
9 changed files with 1495 additions and 1669 deletions

View file

@ -1,15 +1,5 @@
use crate::*;
/// Memoize a rendering.
///
/// ```
/// let _ = tengri::Memo::new((), ());
/// ```
#[derive(Debug, Default)] pub struct Memo<T, U> {
pub value: T,
pub view: Arc<RwLock<U>>
}
pub use self::spatial::*; mod spatial {
use crate::*;
@ -165,23 +155,7 @@ pub use self::spatial::*; mod spatial {
pub value_align: Option<Direction>,
}
}
#[derive(Clone)] pub struct Exit(Arc<AtomicBool>);
impl Exit {
pub fn run <T> (run: impl Fn()->Usually<T>) -> Usually<T> {
run(Self(Arc::new(AtomicBool::new(false))))
}
}
#[derive(Debug)] pub struct Thread {
/// Exit flag.
pub exit: Arc<AtomicBool>,
/// Performance counter.
pub perf: Arc<PerfModel>,
/// Use this to wait for the thread to finish.
pub join: JoinHandle<()>,
}
:wqa
#[cfg(feature = "tui")] pub use self::terminal::*;
#[cfg(feature = "tui")] mod terminal {
use crate::*;