fn trim_common_tail<T: PartialEq>(v1: &mut NonEmpty<T>, v2: &mut NonEmpty<T>) {
    let mut i1 = v1.len().get() - 1;
    let mut i2 = v2.len().get() - 1;
    loop {
        if v1[i1] != v2[i2] {
            let l1 = NonZeroUsize::new(i1.saturating_add(1)).unwrap();
            let l2 = NonZeroUsize::new(i2.saturating_add(1)).unwrap();
            v1.truncate(l1);
            v2.truncate(l2);
            return;
        } else if i1 != 0 && i2 != 0 {
            i1 -= 1;
            i2 -= 1;
        } else {
            // There is no changes to be made to the input vectors
            return;
        }
    }
}
/// Remove all mutually identical elements at the end of `v1` and `v2`
///
/// # Example
///
/// ```rust,ignore
/// # use non_empty_vec::ne_vec;
/// let mut v1 = ne_vec![1,2,3,4,5,6,7];
/// let mut v2 = ne_vec![3,2,1,4,5,6,7];
///
/// trim_common_tail(&mut v1, &mut v2);
///
/// assert_eq!(v1, ne_vec![1,2,3]);
/// assert_eq!(v2, ne_vec![3,2,1]);
/// ```
Remove all mutually identical elements at the end of `v1` and `v2`
Remove all mutually identical elements at the end of ` v1 ` and ` v2 `
fn trim_common_tail<T: PartialEq>(v1: &mut NonEmpty<T>, v2: &mut NonEmpty<T>) {
    let mut i1 = v1.len().get() - 1;
    let mut i2 = v2.len().get() - 1;
    loop {
        if v1[i1] != v2[i2] {
            let l1 = NonZeroUsize::new(i1.saturating_add(1)).unwrap();
            let l2 = NonZeroUsize::new(i2.saturating_add(1)).unwrap();
            v1.truncate(l1);
            v2.truncate(l2);
            return;
        } else if i1 != 0 && i2 != 0 {
            i1 -= 1;
            i2 -= 1;
        } else {
            // There is no changes to be made to the input vectors
            return;
        }
    }
}
fn trim_common_tail < T : PartialEq > ( v1 : & mut NonEmpty < T > , v2 : & mut NonEmpty < T > ) { let mut i1 = v1 . len ( ) . get ( ) - 1 ; let mut i2 = v2 . len ( ) . get ( ) - 1 ; loop { if v1 [ i1 ] != v2 [ i2 ] { let l1 = NonZeroUsize :: new ( i1 . saturating_add ( 1 ) ) . unwrap ( ) ; let l2 = NonZeroUsize :: new ( i2 . saturating_add ( 1 ) ) . unwrap ( ) ; v1 . truncate ( l1 ) ; v2 . truncate ( l2 ) ; return ; } else if i1 != 0 && i2 != 0 { i1 -= 1 ; i2 -= 1 ; } else { // There is no changes to be made to the input vectors return ; } } }
Remove all mutually identical elements at the end of `v1` and `v2`
Remove all mutually identical elements at the end of ` v1 ` and ` v2 `
v1
&mut NonEmpty<T>
v2
&mut NonEmpty<T>
v1
&mut NonEmpty<T>
v2
&mut NonEmpty<T>
example
None
use non_empty_vec::ne_vec;


trim_common_tail(&mut v1, &mut v2).


trim_common_tail ( &mut v1 &mut v2 ) .