Function replace_with::replace_with_and

source ยท
pub fn replace_with_and<T, R, F: FnOnce(T) -> (T, R)>(dst: &mut T, f: F) -> R
Expand description

Uses f to replace the referent of dst and returns a value from the transformation.

Like replace_with but the provided function returns a tuple of (T, R) where T is the new value for dst and R is returned from replace_with_and.