pub struct ArcCallableWith<T, R, E> { /* private fields */ }Expand description
Thread-safe shared callable with mutable input.
ArcCallableWith<T, R, E> stores an
Arc<Mutex<dyn FnMut(&mut T) -> Result<R, E> + Send>>.
§Author
Haixing Hu
Implementations§
Source§impl<T, R, E> ArcCallableWith<T, R, E>
impl<T, R, E> ArcCallableWith<T, R, E>
Sourcepub fn new<F>(function: F) -> Self
pub fn new<F>(function: F) -> Self
Creates a new callable-with.
Wraps the provided closure in the appropriate smart pointer type for this callable-with implementation.
Sourcepub fn new_with_name<F>(name: &str, function: F) -> Self
pub fn new_with_name<F>(name: &str, function: F) -> Self
Creates a new named callable-with.
Wraps the provided closure and assigns it a name, which is useful for debugging and logging purposes.
Sourcepub fn new_with_optional_name<F>(function: F, name: Option<String>) -> Self
pub fn new_with_optional_name<F>(function: F, name: Option<String>) -> Self
Creates a new named callable-with with an optional name.
Wraps the provided closure and assigns it an optional name.
Sourcepub fn clear_name(&mut self)
pub fn clear_name(&mut self)
Clears the name of this callable-with.
Trait Implementations§
Source§impl<T, R, E> CallableWith<T, R, E> for ArcCallableWith<T, R, E>
impl<T, R, E> CallableWith<T, R, E> for ArcCallableWith<T, R, E>
Source§fn call_with(&mut self, input: &mut T) -> Result<R, E>
fn call_with(&mut self, input: &mut T) -> Result<R, E>
Executes the thread-safe callable with mutable input.
Source§fn into_runnable_with(self) -> BoxRunnableWith<T, E>where
Self: Sized + 'static,
fn into_runnable_with(self) -> BoxRunnableWith<T, E>where
Self: Sized + 'static,
Converts this shared callable into a boxed runnable while preserving its name.
Source§fn into_box(self) -> BoxCallableWith<T, R, E>where
Self: 'static,
fn into_box(self) -> BoxCallableWith<T, R, E>where
Self: 'static,
Converts this callable into a boxed callable. Read more
Source§fn into_rc(self) -> RcCallableWith<T, R, E>where
Self: 'static,
fn into_rc(self) -> RcCallableWith<T, R, E>where
Self: 'static,
Converts this callable into an
Rc callable. Read moreSource§fn into_arc(self) -> ArcCallableWith<T, R, E>
fn into_arc(self) -> ArcCallableWith<T, R, E>
Converts this callable into an
Arc callable. Read moreSource§fn into_fn(self) -> impl FnMut(&mut T) -> Result<R, E>
fn into_fn(self) -> impl FnMut(&mut T) -> Result<R, E>
Converts this callable into a mutable closure. Read more
Source§fn to_box(&self) -> BoxCallableWith<T, R, E>where
Self: 'static,
fn to_box(&self) -> BoxCallableWith<T, R, E>where
Self: 'static,
Converts this callable into a boxed callable without consuming
self. Read moreSource§fn to_rc(&self) -> RcCallableWith<T, R, E>where
Self: 'static,
fn to_rc(&self) -> RcCallableWith<T, R, E>where
Self: 'static,
Source§fn to_arc(&self) -> ArcCallableWith<T, R, E>
fn to_arc(&self) -> ArcCallableWith<T, R, E>
Source§impl<T, R, E> Clone for ArcCallableWith<T, R, E>
impl<T, R, E> Clone for ArcCallableWith<T, R, E>
Source§impl<T, R, E> Debug for ArcCallableWith<T, R, E>
impl<T, R, E> Debug for ArcCallableWith<T, R, E>
Auto Trait Implementations§
impl<T, R, E> Freeze for ArcCallableWith<T, R, E>
impl<T, R, E> !RefUnwindSafe for ArcCallableWith<T, R, E>
impl<T, R, E> Send for ArcCallableWith<T, R, E>
impl<T, R, E> Sync for ArcCallableWith<T, R, E>
impl<T, R, E> Unpin for ArcCallableWith<T, R, E>
impl<T, R, E> UnsafeUnpin for ArcCallableWith<T, R, E>
impl<T, R, E> !UnwindSafe for ArcCallableWith<T, R, E>
Blanket Implementations§
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
Mutably borrows from an owned value. Read more