pub struct UncheckedSync<T: ?Sized>(/* private fields */);
Expand description
A wrapper that implements Sync
, even when T
doesn’t.
This type is unsafe to construct, and doesn’t have any checks for whether your usage of the type is actually thread-safe.
Access to the inner value is provided via the Deref
/DerefMut
traits,
and via the into_inner
method.
See the crate-level-docs for more information.
Implementations§
Source§impl<T> UncheckedSync<T>
impl<T> UncheckedSync<T>
Sourcepub const unsafe fn new(value: T) -> Self
pub const unsafe fn new(value: T) -> Self
Constructs a new instance of UncheckedSync
which will wrap the
specified value.
Note that this function is unsafe, while all other API of
UncheckedSync
is safe.
§Safety
All subsequent uses of the constructed UncheckedSync
must be
thread-safe.
Sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Unwraps the UncheckedSync
, consuming it.
Trait Implementations§
Source§impl<T: Copy> Clone for UncheckedSync<T>
UncheckedSync
implements Clone
only when T
is Copy
, not when T
is
Clone
. This impl is provided because it is required for the Copy
impl.
impl<T: Copy> Clone for UncheckedSync<T>
UncheckedSync
implements Clone
only when T
is Copy
, not when T
is
Clone
. This impl is provided because it is required for the Copy
impl.
Source§impl<T: ?Sized> Deref for UncheckedSync<T>
impl<T: ?Sized> Deref for UncheckedSync<T>
Source§impl<T: ?Sized> DerefMut for UncheckedSync<T>
impl<T: ?Sized> DerefMut for UncheckedSync<T>
impl<T: Copy> Copy for UncheckedSync<T>
This impl is provided because, without it, it would be impossible for a
struct containing an UncheckedSync
to implement Copy
.