mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-06 19:56:42 +01:00
simplify
This commit is contained in:
parent
d7bbc2a412
commit
e3a3962130
15 changed files with 74 additions and 81 deletions
|
|
@ -9,24 +9,19 @@ pub(crate) use std::sync::{Arc, atomic::{AtomicUsize, AtomicBool, Ordering::Rela
|
|||
pub(crate) use std::fmt::Debug;
|
||||
pub(crate) use std::ops::{Add, Sub, Mul, Div, Rem};
|
||||
|
||||
pub(crate) use ::tengri::{from, Usually, Perhaps, tui::*};
|
||||
pub(crate) use ::tengri::{from, Usually, Perhaps, Has, tui::*};
|
||||
|
||||
pub use ::atomic_float; pub(crate) use atomic_float::*;
|
||||
|
||||
pub trait Has<T>: Send + Sync {
|
||||
fn get (&self) -> &T;
|
||||
fn get_mut (&mut self) -> &mut T;
|
||||
}
|
||||
//pub trait MaybeHas<T>: Send + Sync {
|
||||
//fn get (&self) -> Option<&T>;
|
||||
//}
|
||||
|
||||
pub trait MaybeHas<T>: Send + Sync {
|
||||
fn get (&self) -> Option<&T>;
|
||||
}
|
||||
|
||||
impl<T, U: Has<Option<T>>> MaybeHas<T> for U {
|
||||
fn get (&self) -> Option<&T> {
|
||||
Has::<Option<T>>::get(self).as_ref()
|
||||
}
|
||||
}
|
||||
//impl<T, U: Has<Option<T>>> MaybeHas<T> for U {
|
||||
//fn get (&self) -> Option<&T> {
|
||||
//Has::<Option<T>>::get(self).as_ref()
|
||||
//}
|
||||
//}
|
||||
|
||||
#[macro_export] macro_rules! has {
|
||||
($T:ty: |$self:ident : $S:ty| $x:expr) => {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue