mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2026-08-07 22:17:07 +02:00
fix Exit; document Size
This commit is contained in:
parent
0273d2ac75
commit
cb382cf12e
3 changed files with 8 additions and 4 deletions
|
|
@ -4,7 +4,7 @@ use crate::Usually;
|
|||
#[derive(Clone)] pub struct Exit(Arc<AtomicBool>);
|
||||
|
||||
impl Exit {
|
||||
pub fn run <T> (run: impl Fn(Self)->Usually<T>) -> Usually<T> {
|
||||
pub fn run <T> (run: impl FnOnce(Self)->Usually<T>) -> Usually<T> {
|
||||
run(Self(Arc::new(AtomicBool::new(false))))
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,12 @@ use super::*;
|
|||
/// Uses [AtomicUsize] to measure size during\
|
||||
/// rendering (which is normally read-only).
|
||||
#[derive(Default, Debug, Clone)]
|
||||
pub struct Size(Arc<AtomicUsize>, Arc<AtomicUsize>);
|
||||
pub struct Size(
|
||||
/// Width
|
||||
pub Arc<AtomicUsize>,
|
||||
/// Height
|
||||
pub Arc<AtomicUsize>,
|
||||
);
|
||||
|
||||
impl PartialEq for Size {
|
||||
fn eq (&self, _: &Self) -> bool {
|
||||
|
|
@ -31,4 +36,3 @@ impl Size {
|
|||
})
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue