-
Notifications
You must be signed in to change notification settings - Fork 8
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
12 changed files
with
320 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,6 +24,7 @@ crossterm = "0.28.1" | |
|
||
[features] | ||
std-duration = [] | ||
sendable = [] | ||
|
||
[[example]] | ||
name = "open-window" | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#[cfg(feature = "sendable")] | ||
pub(super) mod sendable { | ||
use std::sync::{Arc, Mutex}; | ||
use ratatui::buffer::Buffer; | ||
use crate::{CellFilter, Duration, Effect, EffectTimer}; | ||
use crate::fx::{ShaderFn, ShaderFnSignature}; | ||
|
||
// #[warn(dead_code)] | ||
const fn ensure_send<T: Send>() {} | ||
|
||
const _: () = { | ||
ensure_send::<Buffer>(); | ||
ensure_send::<EffectTimer>(); | ||
ensure_send::<CellFilter>(); | ||
ensure_send::<Duration>(); | ||
ensure_send::<ShaderFnSignature<()>>(); | ||
ensure_send::<ShaderFn<()>>(); | ||
}; | ||
|
||
pub type RefCount<T> = Arc<Mutex<T>>; | ||
|
||
pub fn make_ref<T>(value: T) -> RefCount<T> { | ||
Arc::new(Mutex::new(value)) | ||
} | ||
} | ||
|
||
#[cfg(not(feature = "sendable"))] | ||
pub(super) mod sendable { | ||
use std::cell::RefCell; | ||
use std::rc::Rc; | ||
|
||
pub type RefCount<T> = Rc<RefCell<T>>; | ||
|
||
pub fn make_ref<T>(value: T) -> RefCount<T> { | ||
Rc::new(RefCell::new(value)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.