mirror of
https://codeberg.org/unspeaker/tek.git
synced 2025-12-10 13:46:42 +01:00
wip: down to 13 errors
This commit is contained in:
parent
6ce83fb27a
commit
ebdb8881e9
19 changed files with 793 additions and 691 deletions
|
|
@ -18,6 +18,16 @@ pub trait Has<T>: Send + Sync {
|
|||
fn get_mut (&mut self) -> &mut 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()
|
||||
}
|
||||
}
|
||||
|
||||
#[macro_export] macro_rules! has {
|
||||
($T:ty: |$self:ident : $S:ty| $x:expr) => {
|
||||
impl Has<$T> for $S {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue