pub struct FnConverter<F, G> { /* private fields */ }Expand description
A converter that uses closures for conversions.
This is useful when you want to provide custom conversion logic without implementing the TryFrom trait.
Trait Implementations§
Source§impl<F: Clone, G: Clone> Clone for FnConverter<F, G>
impl<F: Clone, G: Clone> Clone for FnConverter<F, G>
Source§fn clone(&self) -> FnConverter<F, G>
fn clone(&self) -> FnConverter<F, G>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<L, R, F, G, EL, ER> Converter<L, R> for FnConverter<F, G>
impl<L, R, F, G, EL, ER> Converter<L, R> for FnConverter<F, G>
Source§type ToLeftError = EL
type ToLeftError = EL
The error type returned when converting from right to left.
Source§type ToRightError = ER
type ToRightError = ER
The error type returned when converting from left to right.
Source§fn convert_to_left(&self, right: &R) -> Result<L, Self::ToLeftError>
fn convert_to_left(&self, right: &R) -> Result<L, Self::ToLeftError>
Converts a reference to a right value into a left value.
Source§fn convert_to_right(&self, left: &L) -> Result<R, Self::ToRightError>
fn convert_to_right(&self, left: &L) -> Result<R, Self::ToRightError>
Converts a reference to a left value into a right value.
Auto Trait Implementations§
impl<F, G> Freeze for FnConverter<F, G>
impl<F, G> RefUnwindSafe for FnConverter<F, G>where
F: RefUnwindSafe,
G: RefUnwindSafe,
impl<F, G> Send for FnConverter<F, G>
impl<F, G> Sync for FnConverter<F, G>
impl<F, G> Unpin for FnConverter<F, G>
impl<F, G> UnwindSafe for FnConverter<F, G>where
F: UnwindSafe,
G: UnwindSafe,
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