random_fast_rng/
thread.rs1use FastRng;
2
3use core::ops::{Deref, DerefMut};
4
5pub struct ThreadFastRng(*mut FastRng);
9
10impl Deref for ThreadFastRng {
11 type Target = FastRng;
12
13 fn deref(&self) -> &Self::Target {
14 unsafe { &*self.0 }
15 }
16}
17
18impl DerefMut for ThreadFastRng {
19 fn deref_mut(&mut self) -> &mut Self::Target {
20 unsafe { &mut *self.0 }
21 }
22}
23
24pub trait FromRawPtr<T> {
25 fn from_ptr(ptr: *mut T) -> Self;
26}
27
28impl FromRawPtr<FastRng> for ThreadFastRng {
29 fn from_ptr(ptr: *mut FastRng) -> ThreadFastRng {
30 ThreadFastRng(ptr)
31 }
32}