1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
use core::convert::{AsMut, AsRef};
use core::ops::{Deref, DerefMut};
#[cfg_attr(docsrs, doc(cfg(feature = "thread_local")))]
pub struct NonSend<T: ?Sized>(pub(crate) T);
impl<T: ?Sized> AsRef<T> for NonSend<T> {
fn as_ref(&self) -> &T {
&self.0
}
}
impl<T: ?Sized> AsMut<T> for NonSend<T> {
fn as_mut(&mut self) -> &mut T {
&mut self.0
}
}
impl<T: ?Sized> Deref for NonSend<T> {
type Target = T;
fn deref(&self) -> &Self::Target {
&self.0
}
}
impl<T: ?Sized> DerefMut for NonSend<T> {
fn deref_mut(&mut self) -> &mut Self::Target {
&mut self.0
}
}