pub struct UncheckedSend<T: ?Sized>(/* private fields */);Expand description
A wrapper that implements Send, 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> UncheckedSend<T>
impl<T> UncheckedSend<T>
Sourcepub const unsafe fn new(value: T) -> Self
pub const unsafe fn new(value: T) -> Self
Constructs a new instance of UncheckedSend which will wrap the
specified value.
Note that this function is unsafe, while all other API of
UncheckedSend is safe.
§Safety
All subsequent uses of the constructed UncheckedSend must be
thread-safe.
Sourcepub fn into_inner(self) -> T
pub fn into_inner(self) -> T
Unwraps the UncheckedSend, consuming it.
Trait Implementations§
Source§impl<T: Copy> Clone for UncheckedSend<T>
UncheckedSend 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 UncheckedSend<T>
UncheckedSend 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 UncheckedSend<T>
impl<T: ?Sized> Deref for UncheckedSend<T>
Source§impl<T: ?Sized> DerefMut for UncheckedSend<T>
impl<T: ?Sized> DerefMut for UncheckedSend<T>
impl<T: Copy> Copy for UncheckedSend<T>
This impl is provided because, without it, it would be impossible for a
struct containing an UncheckedSend to implement Copy.