monoio 0.2.4

A thread per core runtime based on iouring.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
use std::cell::UnsafeCell;

pub(crate) trait UnsafeCellExt<T> {
    fn with<R>(&self, f: impl FnOnce(*const T) -> R) -> R;
    fn with_mut<R>(&self, f: impl FnOnce(*mut T) -> R) -> R;
}

impl<T> UnsafeCellExt<T> for UnsafeCell<T> {
    fn with<R>(&self, f: impl FnOnce(*const T) -> R) -> R {
        f(self.get())
    }

    fn with_mut<R>(&self, f: impl FnOnce(*mut T) -> R) -> R {
        f(self.get())
    }
}