pub struct SendWrapper<T> { /* private fields */ }Expand description
A wrapper that allows sending non-Send types across thread boundaries.
Re-exported from the send_wrapper crate. It implements Send and Sync
regardless of whether the wrapped type is thread-safe. However, it will
panic at runtime if the wrapped value is accessed from any thread other
than the one that created it.
A wrapper which allows you to move around non-Send-types between threads, as long as you access the contained
value only from within the original thread and make sure that it is dropped from within the original thread.
Implementations§
Source§impl<T> SendWrapper<T>
impl<T> SendWrapper<T>
Trait Implementations§
Source§impl<T> Clone for SendWrapper<T>where
T: Clone,
impl<T> Clone for SendWrapper<T>where
T: Clone,
Source§fn clone(&self) -> SendWrapper<T>
fn clone(&self) -> SendWrapper<T>
Returns a copy of the value.
§Panics
Cloning panics if it is done from a different thread than the one
the SendWrapper<T> instance has been created with.
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<T> Debug for SendWrapper<T>where
T: Debug,
impl<T> Debug for SendWrapper<T>where
T: Debug,
Source§impl<T> Deref for SendWrapper<T>
impl<T> Deref for SendWrapper<T>
Source§impl<T> DerefMut for SendWrapper<T>
impl<T> DerefMut for SendWrapper<T>
Source§impl<T> Drop for SendWrapper<T>
impl<T> Drop for SendWrapper<T>
Source§fn drop(&mut self)
fn drop(&mut self)
Drops the contained value.
§Panics
Dropping panics if it is done from a different thread than the one the SendWrapper<T> instance has been
created with.
Exceptions:
- There is no extra panic if the thread is already panicking/unwinding. This is because otherwise there would be double panics (usually resulting in an abort) when dereferencing from a wrong thread.
- If
Thas a trivial drop (needs_drop::<T>()is false) then this method never panics.
impl<T> Send for SendWrapper<T>
impl<T> Sync for SendWrapper<T>
Auto Trait Implementations§
impl<T> Freeze for SendWrapper<T>where
T: Freeze,
impl<T> RefUnwindSafe for SendWrapper<T>where
T: RefUnwindSafe,
impl<T> Unpin for SendWrapper<T>where
T: Unpin,
impl<T> UnsafeUnpin for SendWrapper<T>where
T: UnsafeUnpin,
impl<T> UnwindSafe for SendWrapper<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<R> TryRngCore for Rwhere
R: TryRng,
impl<R> TryRngCore for Rwhere
R: TryRng,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<R> RngExt for R
impl<R> RngExt for R
Source§fn random<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
fn random<T>(&mut self) -> Twhere
StandardUniform: Distribution<T>,
StandardUniform distribution. Read moreSource§fn random_iter<T>(self) -> Iter<StandardUniform, Self, T>
fn random_iter<T>(self) -> Iter<StandardUniform, Self, T>
Source§fn random_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
fn random_range<T, R>(&mut self, range: R) -> Twhere
T: SampleUniform,
R: SampleRange<T>,
Source§fn random_bool(&mut self, p: f64) -> bool
fn random_bool(&mut self, p: f64) -> bool
p of being true. Read moreSource§fn random_ratio(&mut self, numerator: u32, denominator: u32) -> bool
fn random_ratio(&mut self, numerator: u32, denominator: u32) -> bool
numerator/denominator of being
true. Read more