pub struct ArcRunnableWith<T, E> { /* private fields */ }Expand description
Thread-safe shared runnable with mutable input.
ArcRunnableWith<T, E> stores an
Arc<Mutex<dyn FnMut(&mut T) -> Result<(), E> + Send>>.
§Author
Haixing Hu
Implementations§
Source§impl<T, E> ArcRunnableWith<T, E>
impl<T, E> ArcRunnableWith<T, E>
Sourcepub fn new<F>(function: F) -> Self
pub fn new<F>(function: F) -> Self
Creates a new runnable-with.
Wraps the provided closure in the appropriate smart pointer type for this runnable-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 runnable-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 runnable-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 runnable-with.
Trait Implementations§
Source§impl<T, E> Clone for ArcRunnableWith<T, E>
impl<T, E> Clone for ArcRunnableWith<T, E>
Source§impl<T, E> Debug for ArcRunnableWith<T, E>
impl<T, E> Debug for ArcRunnableWith<T, E>
Source§impl<T, E> Display for ArcRunnableWith<T, E>
impl<T, E> Display for ArcRunnableWith<T, E>
Source§impl<T, E> RunnableWith<T, E> for ArcRunnableWith<T, E>
impl<T, E> RunnableWith<T, E> for ArcRunnableWith<T, E>
Source§fn run_with(&mut self, input: &mut T) -> Result<(), E>
fn run_with(&mut self, input: &mut T) -> Result<(), E>
Executes the thread-safe runnable with mutable input.
Source§fn into_box(self) -> BoxRunnableWith<T, E>where
Self: 'static,
fn into_box(self) -> BoxRunnableWith<T, E>where
Self: 'static,
Converts this runnable into a boxed runnable. Read more
Source§fn into_rc(self) -> RcRunnableWith<T, E>where
Self: 'static,
fn into_rc(self) -> RcRunnableWith<T, E>where
Self: 'static,
Converts this runnable into an
Rc runnable. Read moreSource§fn into_arc(self) -> ArcRunnableWith<T, E>
fn into_arc(self) -> ArcRunnableWith<T, E>
Converts this runnable into an
Arc runnable. Read moreSource§fn into_fn(self) -> impl FnMut(&mut T) -> Result<(), E>
fn into_fn(self) -> impl FnMut(&mut T) -> Result<(), E>
Converts this runnable into a mutable closure. Read more
Source§fn to_box(&self) -> BoxRunnableWith<T, E>where
Self: 'static,
fn to_box(&self) -> BoxRunnableWith<T, E>where
Self: 'static,
Converts this runnable into a boxed runnable without consuming
self. Read moreSource§fn to_rc(&self) -> RcRunnableWith<T, E>where
Self: 'static,
fn to_rc(&self) -> RcRunnableWith<T, E>where
Self: 'static,
Source§fn to_arc(&self) -> ArcRunnableWith<T, E>
fn to_arc(&self) -> ArcRunnableWith<T, E>
Source§fn to_fn(&self) -> impl FnMut(&mut T) -> Result<(), E>
fn to_fn(&self) -> impl FnMut(&mut T) -> Result<(), E>
Converts this runnable into a mutable closure without consuming
self. Read moreSource§fn into_callable_with(self) -> BoxCallableWith<T, (), E>where
Self: Sized + 'static,
fn into_callable_with(self) -> BoxCallableWith<T, (), E>where
Self: Sized + 'static,
Converts this runnable into a callable returning unit. Read more
Auto Trait Implementations§
impl<T, E> Freeze for ArcRunnableWith<T, E>
impl<T, E> !RefUnwindSafe for ArcRunnableWith<T, E>
impl<T, E> Send for ArcRunnableWith<T, E>
impl<T, E> Sync for ArcRunnableWith<T, E>
impl<T, E> Unpin for ArcRunnableWith<T, E>
impl<T, E> UnsafeUnpin for ArcRunnableWith<T, E>
impl<T, E> !UnwindSafe for ArcRunnableWith<T, 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