mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2026-04-03 13:30:44 +02:00
wip: refactor(tengri): routines!
This commit is contained in:
parent
8f0a2accce
commit
4e8d58d793
9 changed files with 1495 additions and 1669 deletions
|
|
@ -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::*;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue