1
0
Fork 0
forked from wry/wry

all: split reusable components into workspace crates

This commit is contained in:
kossLAN 2026-05-29 09:14:53 -04:00
parent 2a079ed800
commit 657e7ce2f7
No known key found for this signature in database
225 changed files with 7422 additions and 17602 deletions

View file

@ -1,26 +0,0 @@
#![allow(dead_code)]
use std::{cell::Cell, future::Future};
#[derive(Default)]
pub struct Once {
done: Cell<bool>,
}
impl Once {
pub fn set(&self) -> bool {
!self.done.replace(true)
}
pub fn exec<F: FnOnce()>(&self, f: F) {
if !self.done.replace(true) {
f();
}
}
pub async fn exec_async<G: Future<Output = ()>, F: FnOnce() -> G>(&self, f: F) {
if !self.done.replace(true) {
f().await;
}
}
}