pub struct BoxCallableWith<T, R, E> { /* private fields */ }Expand description
Box-based callable with mutable input.
BoxCallableWith<T, R, E> stores a
Box<dyn FnMut(&mut T) -> Result<R, E>> and can be called repeatedly.
§Author
Haixing Hu
Implementations§
Source§impl<T, R, E> BoxCallableWith<T, R, E>
impl<T, R, E> BoxCallableWith<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.
Sourcepub fn map<U, M>(self, mapper: M) -> BoxCallableWith<T, U, E>where
M: FnMut(R) -> U + 'static,
T: 'static,
R: 'static,
E: 'static,
pub fn map<U, M>(self, mapper: M) -> BoxCallableWith<T, U, E>where
M: FnMut(R) -> U + 'static,
T: 'static,
R: 'static,
E: 'static,
Sourcepub fn map_err<E2, M>(self, mapper: M) -> BoxCallableWith<T, R, E2>where
M: FnMut(E) -> E2 + 'static,
T: 'static,
R: 'static,
E: 'static,
pub fn map_err<E2, M>(self, mapper: M) -> BoxCallableWith<T, R, E2>where
M: FnMut(E) -> E2 + 'static,
T: 'static,
R: 'static,
E: 'static,
Sourcepub fn and_then<U, N>(self, next: N) -> BoxCallableWith<T, U, E>
pub fn and_then<U, N>(self, next: N) -> BoxCallableWith<T, U, E>
Trait Implementations§
Source§impl<T, R, E> CallableWith<T, R, E> for BoxCallableWith<T, R, E>
impl<T, R, E> CallableWith<T, R, E> for BoxCallableWith<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 boxed 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 boxed callable into a boxed runnable while preserving its name.
Source§fn into_box(self) -> BoxCallableWith<T, R, E>
fn into_box(self) -> BoxCallableWith<T, R, E>
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§impl<T, R, E> Debug for BoxCallableWith<T, R, E>
impl<T, R, E> Debug for BoxCallableWith<T, R, E>
Auto Trait Implementations§
impl<T, R, E> Freeze for BoxCallableWith<T, R, E>
impl<T, R, E> !RefUnwindSafe for BoxCallableWith<T, R, E>
impl<T, R, E> !Send for BoxCallableWith<T, R, E>
impl<T, R, E> !Sync for BoxCallableWith<T, R, E>
impl<T, R, E> Unpin for BoxCallableWith<T, R, E>
impl<T, R, E> UnsafeUnpin for BoxCallableWith<T, R, E>
impl<T, R, E> !UnwindSafe for BoxCallableWith<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