This module has been deprecated in favor of the dedicated deadpool-sync
utility crate.
managed
only.Expand description
Wrapper for objects which only provides blocking functions that need to be called on a separate thread.
Access to the wrapped object is provided via the SyncWrapper::interact()
method.
Implementations
sourceimpl<T, E> SyncWrapper<T, E> where
T: Send + 'static,
E: Send + 'static,
impl<T, E> SyncWrapper<T, E> where
T: Send + 'static,
E: Send + 'static,
sourcepub async fn new<F>(runtime: Runtime, f: F) -> Result<Self, E> where
F: FnOnce() -> Result<T, E> + Send + 'static,
👎 Deprecated since 0.9.1: This module has been deprecated in favor of the dedicated deadpool-sync
utility crate.
pub async fn new<F>(runtime: Runtime, f: F) -> Result<Self, E> where
F: FnOnce() -> Result<T, E> + Send + 'static,
This module has been deprecated in favor of the dedicated deadpool-sync
utility crate.
Creates a new wrapped object.
sourcepub async fn interact<F, R>(&self, f: F) -> Result<R, InteractError<E>> where
F: FnOnce(&mut T) -> Result<R, E> + Send + 'static,
R: Send + 'static,
👎 Deprecated since 0.9.1: This module has been deprecated in favor of the dedicated deadpool-sync
utility crate.
pub async fn interact<F, R>(&self, f: F) -> Result<R, InteractError<E>> where
F: FnOnce(&mut T) -> Result<R, E> + Send + 'static,
R: Send + 'static,
This module has been deprecated in favor of the dedicated deadpool-sync
utility crate.
Interacts with the underlying object.
Expects a closure that takes the object as its parameter. The closure is executed in a separate thread so that the async runtime is not blocked.
sourcepub fn is_mutex_poisoned(&self) -> bool
👎 Deprecated since 0.9.1: This module has been deprecated in favor of the dedicated deadpool-sync
utility crate.
pub fn is_mutex_poisoned(&self) -> bool
This module has been deprecated in favor of the dedicated deadpool-sync
utility crate.
Indicates whether the underlying Mutex
has been poisoned.
This happens when a panic occurs while interacting with the object.
sourcepub fn lock(
&self
) -> Result<SyncGuard<'_, T>, PoisonError<MutexGuard<'_, Option<T>>>>
👎 Deprecated since 0.9.1: This module has been deprecated in favor of the dedicated deadpool-sync
utility crate.
pub fn lock(
&self
) -> Result<SyncGuard<'_, T>, PoisonError<MutexGuard<'_, Option<T>>>>
This module has been deprecated in favor of the dedicated deadpool-sync
utility crate.
Lock the underlying mutex and return a guard for the inner object.
sourcepub fn try_lock(
&self
) -> Result<SyncGuard<'_, T>, TryLockError<MutexGuard<'_, Option<T>>>>
👎 Deprecated since 0.9.1: This module has been deprecated in favor of the dedicated deadpool-sync
utility crate.
pub fn try_lock(
&self
) -> Result<SyncGuard<'_, T>, TryLockError<MutexGuard<'_, Option<T>>>>
This module has been deprecated in favor of the dedicated deadpool-sync
utility crate.
Try to lock the underlying mutex and return a guard for the inner object.
Trait Implementations
Auto Trait Implementations
impl<T, E> RefUnwindSafe for SyncWrapper<T, E>
impl<T, E> Send for SyncWrapper<T, E>
impl<T, E> Sync for SyncWrapper<T, E>
impl<T, E> Unpin for SyncWrapper<T, E>
impl<T, E> UnwindSafe for SyncWrapper<T, E>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more