mirror of
https://codeberg.org/unspeaker/tengri.git
synced 2026-04-03 21:40:44 +02:00
This commit is contained in:
parent
4e8d58d793
commit
b0fbe3c173
18 changed files with 1724 additions and 1808 deletions
71
src/lib.rs
Normal file
71
src/lib.rs
Normal file
|
|
@ -0,0 +1,71 @@
|
|||
#![feature(anonymous_lifetime_in_impl_trait)]
|
||||
#![feature(associated_type_defaults)]
|
||||
#![feature(const_default)]
|
||||
#![feature(const_option_ops)]
|
||||
#![feature(const_precise_live_drops)]
|
||||
#![feature(const_trait_impl)]
|
||||
#![feature(impl_trait_in_assoc_type)]
|
||||
#![feature(step_trait)]
|
||||
#![feature(trait_alias)]
|
||||
#![feature(type_alias_impl_trait)]
|
||||
#![feature(type_changing_struct_update)]
|
||||
pub extern crate atomic_float;
|
||||
pub extern crate palette;
|
||||
pub extern crate better_panic;
|
||||
pub extern crate unicode_width;
|
||||
#[cfg(test)] #[macro_use] pub extern crate proptest;
|
||||
|
||||
pub(crate) use ::{
|
||||
atomic_float::AtomicF64,
|
||||
std::fmt::{Debug, Display},
|
||||
std::ops::{Add, Sub, Mul, Div},
|
||||
std::sync::{Arc, RwLock},
|
||||
std::sync::atomic::{AtomicBool, AtomicUsize, Ordering::*},
|
||||
};
|
||||
|
||||
#[cfg(feature = "lang")] pub extern crate dizzle as lang;
|
||||
#[cfg(feature = "lang")] pub use ::dizzle::{self, Usually, Perhaps, impl_default};
|
||||
|
||||
#[cfg(feature = "time")] pub mod time;
|
||||
#[cfg(feature = "play")] pub mod play;
|
||||
#[cfg(feature = "sing")] pub extern crate jack;
|
||||
#[cfg(feature = "sing")] pub mod sing;
|
||||
#[cfg(feature = "sing")] pub use ::jack::{*, contrib::{*, ClosureProcessHandler}};
|
||||
|
||||
#[cfg(feature = "draw")] pub mod draw;
|
||||
#[cfg(feature = "draw")] pub mod color;
|
||||
#[cfg(feature = "text")] pub mod text;
|
||||
#[cfg(feature = "tui")] pub mod tui;
|
||||
#[cfg(feature = "tui")] pub extern crate ratatui;
|
||||
#[cfg(feature = "tui")] pub extern crate crossterm;
|
||||
|
||||
/// Define a trait an implement it for various mutation-enabled wrapper types. */
|
||||
#[macro_export] macro_rules! flex_trait_mut (
|
||||
($Trait:ident $(<$($A:ident:$T:ident),+>)? {
|
||||
$(fn $fn:ident (&mut $self:ident $(, $arg:ident:$ty:ty)*) -> $ret:ty $body:block)*
|
||||
})=>{
|
||||
pub trait $Trait $(<$($A: $T),+>)? {
|
||||
$(fn $fn (&mut $self $(,$arg:$ty)*) -> $ret $body)*
|
||||
}
|
||||
impl<$($($A: $T,)+)? _T_: $Trait $(<$($A),+>)?> $Trait $(<$($A),+>)? for &mut _T_ {
|
||||
$(fn $fn (&mut $self $(,$arg:$ty)*) -> $ret { (*$self).$fn($($arg),*) })*
|
||||
}
|
||||
impl<$($($A: $T,)+)? _T_: $Trait $(<$($A),+>)?> $Trait $(<$($A),+>)? for Option<_T_> {
|
||||
$(fn $fn (&mut $self $(,$arg:$ty)*) -> $ret {
|
||||
if let Some(this) = $self { this.$fn($($arg),*) } else { Ok(None) }
|
||||
})*
|
||||
}
|
||||
impl<$($($A: $T,)+)? _T_: $Trait $(<$($A),+>)?> $Trait $(<$($A),+>)? for ::std::sync::Mutex<_T_> {
|
||||
$(fn $fn (&mut $self $(,$arg:$ty)*) -> $ret { $self.get_mut().unwrap().$fn($($arg),*) })*
|
||||
}
|
||||
impl<$($($A: $T,)+)? _T_: $Trait $(<$($A),+>)?> $Trait $(<$($A),+>)? for ::std::sync::Arc<::std::sync::Mutex<_T_>> {
|
||||
$(fn $fn (&mut $self $(,$arg:$ty)*) -> $ret { $self.lock().unwrap().$fn($($arg),*) })*
|
||||
}
|
||||
impl<$($($A: $T,)+)? _T_: $Trait $(<$($A),+>)?> $Trait $(<$($A),+>)? for ::std::sync::RwLock<_T_> {
|
||||
$(fn $fn (&mut $self $(,$arg:$ty)*) -> $ret { $self.write().unwrap().$fn($($arg),*) })*
|
||||
}
|
||||
impl<$($($A: $T,)+)? _T_: $Trait $(<$($A),+>)?> $Trait $(<$($A),+>)? for ::std::sync::Arc<::std::sync::RwLock<_T_>> {
|
||||
$(fn $fn (&mut $self $(,$arg:$ty)*) -> $ret { $self.write().unwrap().$fn($($arg),*) })*
|
||||
}
|
||||
};
|
||||
);
|
||||
Loading…
Add table
Add a link
Reference in a new issue