use core::{marker::Destruct, ops::AsyncFn, pin::Pin};
use array_trait::Array;
use slice_ops::AsSlice;
use crate::form::ArrayForm;
use super::ArrayEnumerateMeet;
#[const_trait]
pub trait ArrayMeet<T, const N: usize>: Array + AsSlice<Item = T>
{
fn meet_each<'a, F, Rhs>(&'a self, rhs: Rhs, visitor: F)
where
Rhs: ArrayForm<N>,
F: FnMut(&'a T, Rhs::Elem) + ~const Destruct,
T: 'a;
fn meet_each_mut<'a, F, Rhs>(&'a mut self, rhs: Rhs, visitor: F)
where
Rhs: ArrayForm<N>,
F: FnMut(&'a mut T, Rhs::Elem) + ~const Destruct,
T: 'a;
fn meet_each_pin<'a, F, Rhs>(self: Pin<&'a Self>, rhs: Rhs, visitor: F)
where
Rhs: ArrayForm<N>,
F: FnMut(Pin<&'a T>, Rhs::Elem) + ~const Destruct,
T: 'a;
fn meet_each_pin_mut<'a, F, Rhs>(self: Pin<&'a mut Self>, rhs: Rhs, visitor: F)
where
Rhs: ArrayForm<N>,
F: FnMut(Pin<&'a mut T>, Rhs::Elem) + ~const Destruct,
T: 'a;
fn try_meet_each<'a, E, F, Rhs>(&'a self, rhs: Rhs, visitor: F) -> Result<(), E>
where
Rhs: ArrayForm<N>,
F: FnMut(&'a T, Rhs::Elem) -> Result<(), E> + ~const Destruct,
T: 'a;
fn try_meet_each_mut<'a, E, F, Rhs>(&'a mut self, rhs: Rhs, visitor: F) -> Result<(), E>
where
Rhs: ArrayForm<N>,
F: FnMut(&'a mut T, Rhs::Elem) -> Result<(), E> + ~const Destruct,
T: 'a;
fn try_meet_each_pin<'a, E, F, Rhs>(self: Pin<&'a Self>, rhs: Rhs, visitor: F) -> Result<(), E>
where
Rhs: ArrayForm<N>,
F: FnMut(Pin<&'a T>, Rhs::Elem) -> Result<(), E> + ~const Destruct,
T: 'a;
fn try_meet_each_pin_mut<'a, E, F, Rhs>(self: Pin<&'a mut Self>, rhs: Rhs, visitor: F) -> Result<(), E>
where
Rhs: ArrayForm<N>,
F: FnMut(Pin<&'a mut T>, Rhs::Elem) -> Result<(), E> + ~const Destruct,
T: 'a;
fn rmeet_each<'a, F, Rhs>(&'a self, rhs: Rhs, visitor: F)
where
Rhs: ArrayForm<N>,
F: FnMut(&'a T, Rhs::Elem) + ~const Destruct,
T: 'a;
fn rmeet_each_mut<'a, F, Rhs>(&'a mut self, rhs: Rhs, visitor: F)
where
Rhs: ArrayForm<N>,
F: FnMut(&'a mut T, Rhs::Elem) + ~const Destruct,
T: 'a;
fn rmeet_each_pin<'a, F, Rhs>(self: Pin<&'a Self>, rhs: Rhs, visitor: F)
where
Rhs: ArrayForm<N>,
F: FnMut(Pin<&'a T>, Rhs::Elem) + ~const Destruct,
T: 'a;
fn rmeet_each_pin_mut<'a, F, Rhs>(self: Pin<&'a mut Self>, rhs: Rhs, visitor: F)
where
Rhs: ArrayForm<N>,
F: FnMut(Pin<&'a mut T>, Rhs::Elem) + ~const Destruct,
T: 'a;
fn try_rmeet_each<'a, E, F, Rhs>(&'a self, rhs: Rhs, visitor: F) -> Result<(), E>
where
Rhs: ArrayForm<N>,
F: FnMut(&'a T, Rhs::Elem) -> Result<(), E> + ~const Destruct,
T: 'a;
fn try_rmeet_each_mut<'a, E, F, Rhs>(&'a mut self, rhs: Rhs, visitor: F) -> Result<(), E>
where
Rhs: ArrayForm<N>,
F: FnMut(&'a mut T, Rhs::Elem) -> Result<(), E> + ~const Destruct,
T: 'a;
fn try_rmeet_each_pin<'a, E, F, Rhs>(self: Pin<&'a Self>, rhs: Rhs, visitor: F) -> Result<(), E>
where
Rhs: ArrayForm<N>,
F: FnMut(Pin<&'a T>, Rhs::Elem) -> Result<(), E> + ~const Destruct,
T: 'a;
fn try_rmeet_each_pin_mut<'a, E, F, Rhs>(self: Pin<&'a mut Self>, rhs: Rhs, visitor: F) -> Result<(), E>
where
Rhs: ArrayForm<N>,
F: FnMut(Pin<&'a mut T>, Rhs::Elem) -> Result<(), E> + ~const Destruct,
T: 'a;
async fn meet_each_async<'a, F, Rhs>(&'a self, rhs: Rhs, visitor: F)
where
Rhs: ArrayForm<N>,
F: AsyncFn(&'a T, Rhs::Elem) + ~const Destruct,
T: 'a;
async fn meet_each_mut_async<'a, F, Rhs>(&'a mut self, rhs: Rhs, visitor: F)
where
Rhs: ArrayForm<N>,
F: AsyncFn(&'a mut T, Rhs::Elem) + ~const Destruct,
T: 'a;
async fn meet_each_pin_async<'a, F, Rhs>(self: Pin<&'a Self>, rhs: Rhs, visitor: F)
where
Rhs: ArrayForm<N>,
F: AsyncFn(Pin<&'a T>, Rhs::Elem) + ~const Destruct,
T: 'a;
async fn meet_each_pin_mut_async<'a, F, Rhs>(self: Pin<&'a mut Self>, rhs: Rhs, visitor: F)
where
Rhs: ArrayForm<N>,
F: AsyncFn(Pin<&'a mut T>, Rhs::Elem) + ~const Destruct,
T: 'a;
async fn try_meet_each_async<'a, E, F, Rhs>(&'a self, rhs: Rhs, visitor: F) -> Result<(), E>
where
Rhs: ArrayForm<N>,
F: AsyncFn(&'a T, Rhs::Elem) -> Result<(), E> + ~const Destruct,
T: 'a;
async fn try_meet_each_mut_async<'a, E, F, Rhs>(&'a mut self, rhs: Rhs, visitor: F) -> Result<(), E>
where
Rhs: ArrayForm<N>,
F: AsyncFn(&'a mut T, Rhs::Elem) -> Result<(), E> + ~const Destruct,
T: 'a;
async fn try_meet_each_pin_async<'a, E, F, Rhs>(self: Pin<&'a Self>, rhs: Rhs, visitor: F) -> Result<(), E>
where
Rhs: ArrayForm<N>,
F: AsyncFn(Pin<&'a T>, Rhs::Elem) -> Result<(), E> + ~const Destruct,
T: 'a;
async fn try_meet_each_pin_mut_async<'a, E, F, Rhs>(self: Pin<&'a mut Self>, rhs: Rhs, visitor: F) -> Result<(), E>
where
Rhs: ArrayForm<N>,
F: AsyncFn(Pin<&'a mut T>, Rhs::Elem) -> Result<(), E> + ~const Destruct,
T: 'a;
fn meet_all<'a, F, Rhs>(&'a self, rhs: Rhs, visitor: F)
where
Rhs: Copy,
F: FnMut(&'a T, Rhs) + ~const Destruct,
T: 'a;
fn meet_all_mut<'a, F, Rhs>(&'a mut self, rhs: Rhs, visitor: F)
where
Rhs: Copy,
F: FnMut(&'a mut T, Rhs) + ~const Destruct,
T: 'a;
fn meet_all_pin<'a, F, Rhs>(self: Pin<&'a Self>, rhs: Rhs, visitor: F)
where
Rhs: Copy,
F: FnMut(Pin<&'a T>, Rhs) + ~const Destruct,
T: 'a;
fn meet_all_pin_mut<'a, F, Rhs>(self: Pin<&'a mut Self>, rhs: Rhs, visitor: F)
where
Rhs: Copy,
F: FnMut(Pin<&'a mut T>, Rhs) + ~const Destruct,
T: 'a;
fn try_meet_all<'a, E, F, Rhs>(&'a self, rhs: Rhs, visitor: F) -> Result<(), E>
where
Rhs: Copy,
F: FnMut(&'a T, Rhs) -> Result<(), E> + ~const Destruct,
T: 'a;
fn try_meet_all_mut<'a, E, F, Rhs>(&'a mut self, rhs: Rhs, visitor: F) -> Result<(), E>
where
Rhs: Copy,
F: FnMut(&'a mut T, Rhs) -> Result<(), E> + ~const Destruct,
T: 'a;
fn try_meet_all_pin<'a, E, F, Rhs>(self: Pin<&'a Self>, rhs: Rhs, visitor: F) -> Result<(), E>
where
Rhs: Copy,
F: FnMut(Pin<&'a T>, Rhs) -> Result<(), E> + ~const Destruct,
T: 'a;
fn try_meet_all_pin_mut<'a, E, F, Rhs>(self: Pin<&'a mut Self>, rhs: Rhs, visitor: F) -> Result<(), E>
where
Rhs: Copy,
F: FnMut(Pin<&'a mut T>, Rhs) -> Result<(), E> + ~const Destruct,
T: 'a;
fn rmeet_all<'a, F, Rhs>(&'a self, rhs: Rhs, visitor: F)
where
Rhs: Copy,
F: FnMut(&'a T, Rhs) + ~const Destruct,
T: 'a;
fn rmeet_all_mut<'a, F, Rhs>(&'a mut self, rhs: Rhs, visitor: F)
where
Rhs: Copy,
F: FnMut(&'a mut T, Rhs) + ~const Destruct,
T: 'a;
fn rmeet_all_pin<'a, F, Rhs>(self: Pin<&'a Self>, rhs: Rhs, visitor: F)
where
Rhs: Copy,
F: FnMut(Pin<&'a T>, Rhs) + ~const Destruct,
T: 'a;
fn rmeet_all_pin_mut<'a, F, Rhs>(self: Pin<&'a mut Self>, rhs: Rhs, visitor: F)
where
Rhs: Copy,
F: FnMut(Pin<&'a mut T>, Rhs) + ~const Destruct,
T: 'a;
fn try_rmeet_all<'a, E, F, Rhs>(&'a self, rhs: Rhs, visitor: F) -> Result<(), E>
where
Rhs: Copy,
F: FnMut(&'a T, Rhs) -> Result<(), E> + ~const Destruct,
T: 'a;
fn try_rmeet_all_mut<'a, E, F, Rhs>(&'a mut self, rhs: Rhs, visitor: F) -> Result<(), E>
where
Rhs: Copy,
F: FnMut(&'a mut T, Rhs) -> Result<(), E> + ~const Destruct,
T: 'a;
fn try_rmeet_all_pin<'a, E, F, Rhs>(self: Pin<&'a Self>, rhs: Rhs, visitor: F) -> Result<(), E>
where
Rhs: Copy,
F: FnMut(Pin<&'a T>, Rhs) -> Result<(), E> + ~const Destruct,
T: 'a;
fn try_rmeet_all_pin_mut<'a, E, F, Rhs>(self: Pin<&'a mut Self>, rhs: Rhs, visitor: F) -> Result<(), E>
where
Rhs: Copy,
F: FnMut(Pin<&'a mut T>, Rhs) -> Result<(), E> + ~const Destruct,
T: 'a;
async fn meet_all_async<'a, F, Rhs>(&'a self, rhs: Rhs, visitor: F)
where
Rhs: Copy,
F: AsyncFn(&'a T, Rhs) + ~const Destruct,
T: 'a;
async fn meet_all_mut_async<'a, F, Rhs>(&'a mut self, rhs: Rhs, visitor: F)
where
Rhs: Copy,
F: AsyncFn(&'a mut T, Rhs) + ~const Destruct,
T: 'a;
async fn meet_all_pin_async<'a, F, Rhs>(self: Pin<&'a Self>, rhs: Rhs, visitor: F)
where
Rhs: Copy,
F: AsyncFn(Pin<&'a T>, Rhs) + ~const Destruct,
T: 'a;
async fn meet_all_pin_mut_async<'a, F, Rhs>(self: Pin<&'a mut Self>, rhs: Rhs, visitor: F)
where
Rhs: Copy,
F: AsyncFn(Pin<&'a mut T>, Rhs) + ~const Destruct,
T: 'a;
async fn try_meet_all_async<'a, E, F, Rhs>(&'a self, rhs: Rhs, visitor: F) -> Result<(), E>
where
Rhs: Copy,
F: AsyncFn(&'a T, Rhs) -> Result<(), E> + ~const Destruct,
T: 'a;
async fn try_meet_all_mut_async<'a, E, F, Rhs>(&'a mut self, rhs: Rhs, visitor: F) -> Result<(), E>
where
Rhs: Copy,
F: AsyncFn(&'a mut T, Rhs) -> Result<(), E> + ~const Destruct,
T: 'a;
async fn try_meet_all_pin_async<'a, E, F, Rhs>(self: Pin<&'a Self>, rhs: Rhs, visitor: F) -> Result<(), E>
where
Rhs: Copy,
F: AsyncFn(Pin<&'a T>, Rhs) -> Result<(), E> + ~const Destruct,
T: 'a;
async fn try_meet_all_pin_mut_async<'a, E, F, Rhs>(self: Pin<&'a mut Self>, rhs: Rhs, visitor: F) -> Result<(), E>
where
Rhs: Copy,
F: AsyncFn(Pin<&'a mut T>, Rhs) -> Result<(), E> + ~const Destruct,
T: 'a;
}
impl<T, const N: usize> ArrayMeet<T, N> for [T; N]
{
fn meet_each<'a, F, Rhs>(&'a self, rhs: Rhs, mut visitor: F)
where
Rhs: ArrayForm<N>,
F: FnMut(&'a T, Rhs::Elem),
T: 'a
{
self.enumerate_meet_each(rhs, |_, x, y| visitor(x, y))
}
fn meet_each_mut<'a, F, Rhs>(&'a mut self, rhs: Rhs, mut visitor: F)
where
Rhs: ArrayForm<N>,
F: FnMut(&'a mut T, Rhs::Elem),
T: 'a
{
self.enumerate_meet_each_mut(rhs, |_, x, y| visitor(x, y))
}
fn meet_each_pin<'a, F, Rhs>(self: Pin<&'a Self>, rhs: Rhs, mut visitor: F)
where
Rhs: ArrayForm<N>,
F: FnMut(Pin<&'a T>, Rhs::Elem),
T: 'a
{
self.enumerate_meet_each_pin(rhs, |_, x, y| visitor(x, y))
}
fn meet_each_pin_mut<'a, F, Rhs>(self: Pin<&'a mut Self>, rhs: Rhs, mut visitor: F)
where
Rhs: ArrayForm<N>,
F: FnMut(Pin<&'a mut T>, Rhs::Elem),
T: 'a
{
self.enumerate_meet_each_pin_mut(rhs, |_, x, y| visitor(x, y))
}
fn try_meet_each<'a, E, F, Rhs>(&'a self, rhs: Rhs, mut visitor: F) -> Result<(), E>
where
Rhs: ArrayForm<N>,
F: FnMut(&'a T, Rhs::Elem) -> Result<(), E>,
T: 'a
{
self.try_enumerate_meet_each(rhs, |_, x, y| visitor(x, y))
}
fn try_meet_each_mut<'a, E, F, Rhs>(&'a mut self, rhs: Rhs, mut visitor: F) -> Result<(), E>
where
Rhs: ArrayForm<N>,
F: FnMut(&'a mut T, Rhs::Elem) -> Result<(), E>,
T: 'a
{
self.try_enumerate_meet_each_mut(rhs, |_, x, y| visitor(x, y))
}
fn try_meet_each_pin<'a, E, F, Rhs>(self: Pin<&'a Self>, rhs: Rhs, mut visitor: F) -> Result<(), E>
where
Rhs: ArrayForm<N>,
F: FnMut(Pin<&'a T>, Rhs::Elem) -> Result<(), E>,
T: 'a
{
self.try_enumerate_meet_each_pin(rhs, |_, x, y| visitor(x, y))
}
fn try_meet_each_pin_mut<'a, E, F, Rhs>(self: Pin<&'a mut Self>, rhs: Rhs, mut visitor: F) -> Result<(), E>
where
Rhs: ArrayForm<N>,
F: FnMut(Pin<&'a mut T>, Rhs::Elem) -> Result<(), E>,
T: 'a
{
self.try_enumerate_meet_each_pin_mut(rhs, |_, x, y| visitor(x, y))
}
fn rmeet_each<'a, F, Rhs>(&'a self, rhs: Rhs, mut visitor: F)
where
Rhs: ArrayForm<N>,
F: FnMut(&'a T, Rhs::Elem),
T: 'a
{
self.enumerate_rmeet_each(rhs, |_, x, y| visitor(x, y))
}
fn rmeet_each_mut<'a, F, Rhs>(&'a mut self, rhs: Rhs, mut visitor: F)
where
Rhs: ArrayForm<N>,
F: FnMut(&'a mut T, Rhs::Elem),
T: 'a
{
self.enumerate_rmeet_each_mut(rhs, |_, x, y| visitor(x, y))
}
fn rmeet_each_pin<'a, F, Rhs>(self: Pin<&'a Self>, rhs: Rhs, mut visitor: F)
where
Rhs: ArrayForm<N>,
F: FnMut(Pin<&'a T>, Rhs::Elem),
T: 'a
{
self.enumerate_rmeet_each_pin(rhs, |_, x, y| visitor(x, y))
}
fn rmeet_each_pin_mut<'a, F, Rhs>(self: Pin<&'a mut Self>, rhs: Rhs, mut visitor: F)
where
Rhs: ArrayForm<N>,
F: FnMut(Pin<&'a mut T>, Rhs::Elem),
T: 'a
{
self.enumerate_rmeet_each_pin_mut(rhs, |_, x, y| visitor(x, y))
}
fn try_rmeet_each<'a, E, F, Rhs>(&'a self, rhs: Rhs, mut visitor: F) -> Result<(), E>
where
Rhs: ArrayForm<N>,
F: FnMut(&'a T, Rhs::Elem) -> Result<(), E>,
T: 'a
{
self.try_enumerate_rmeet_each(rhs, |_, x, y| visitor(x, y))
}
fn try_rmeet_each_mut<'a, E, F, Rhs>(&'a mut self, rhs: Rhs, mut visitor: F) -> Result<(), E>
where
Rhs: ArrayForm<N>,
F: FnMut(&'a mut T, Rhs::Elem) -> Result<(), E>,
T: 'a
{
self.try_enumerate_rmeet_each_mut(rhs, |_, x, y| visitor(x, y))
}
fn try_rmeet_each_pin<'a, E, F, Rhs>(self: Pin<&'a Self>, rhs: Rhs, mut visitor: F) -> Result<(), E>
where
Rhs: ArrayForm<N>,
F: FnMut(Pin<&'a T>, Rhs::Elem) -> Result<(), E>,
T: 'a
{
self.try_enumerate_rmeet_each_pin(rhs, |_, x, y| visitor(x, y))
}
fn try_rmeet_each_pin_mut<'a, E, F, Rhs>(self: Pin<&'a mut Self>, rhs: Rhs, mut visitor: F) -> Result<(), E>
where
Rhs: ArrayForm<N>,
F: FnMut(Pin<&'a mut T>, Rhs::Elem) -> Result<(), E>,
T: 'a
{
self.try_enumerate_rmeet_each_pin_mut(rhs, |_, x, y| visitor(x, y))
}
async fn meet_each_async<'a, F, Rhs>(&'a self, rhs: Rhs, visitor: F)
where
Rhs: ArrayForm<N>,
F: AsyncFn(&'a T, Rhs::Elem),
T: 'a
{
self.enumerate_meet_each_async(rhs, |_, x, y| visitor(x, y)).await
}
async fn meet_each_mut_async<'a, F, Rhs>(&'a mut self, rhs: Rhs, visitor: F)
where
Rhs: ArrayForm<N>,
F: AsyncFn(&'a mut T, Rhs::Elem),
T: 'a
{
self.enumerate_meet_each_mut_async(rhs, |_, x, y| visitor(x, y)).await
}
async fn meet_each_pin_async<'a, F, Rhs>(self: Pin<&'a Self>, rhs: Rhs, visitor: F)
where
Rhs: ArrayForm<N>,
F: AsyncFn(Pin<&'a T>, Rhs::Elem),
T: 'a
{
self.enumerate_meet_each_pin_async(rhs, |_, x, y| visitor(x, y)).await
}
async fn meet_each_pin_mut_async<'a, F, Rhs>(self: Pin<&'a mut Self>, rhs: Rhs, visitor: F)
where
Rhs: ArrayForm<N>,
F: AsyncFn(Pin<&'a mut T>, Rhs::Elem),
T: 'a
{
self.enumerate_meet_each_pin_mut_async(rhs, |_, x, y| visitor(x, y)).await
}
async fn try_meet_each_async<'a, E, F, Rhs>(&'a self, rhs: Rhs, visitor: F) -> Result<(), E>
where
Rhs: ArrayForm<N>,
F: AsyncFn(&'a T, Rhs::Elem) -> Result<(), E>,
T: 'a
{
self.try_enumerate_meet_each_async(rhs, |_, x, y| visitor(x, y)).await
}
async fn try_meet_each_mut_async<'a, E, F, Rhs>(&'a mut self, rhs: Rhs, visitor: F) -> Result<(), E>
where
Rhs: ArrayForm<N>,
F: AsyncFn(&'a mut T, Rhs::Elem) -> Result<(), E>,
T: 'a
{
self.try_enumerate_meet_each_mut_async(rhs, |_, x, y| visitor(x, y)).await
}
async fn try_meet_each_pin_async<'a, E, F, Rhs>(self: Pin<&'a Self>, rhs: Rhs, visitor: F) -> Result<(), E>
where
Rhs: ArrayForm<N>,
F: AsyncFn(Pin<&'a T>, Rhs::Elem) -> Result<(), E>,
T: 'a
{
self.try_enumerate_meet_each_pin_async(rhs, |_, x, y| visitor(x, y)).await
}
async fn try_meet_each_pin_mut_async<'a, E, F, Rhs>(self: Pin<&'a mut Self>, rhs: Rhs, visitor: F) -> Result<(), E>
where
Rhs: ArrayForm<N>,
F: AsyncFn(Pin<&'a mut T>, Rhs::Elem) -> Result<(), E>,
T: 'a
{
self.try_enumerate_meet_each_pin_mut_async(rhs, |_, x, y| visitor(x, y)).await
}
fn meet_all<'a, F, Rhs>(&'a self, rhs: Rhs, mut visitor: F)
where
Rhs: Copy,
F: FnMut(&'a T, Rhs),
T: 'a
{
self.enumerate_meet_all(rhs, |_, x, y| visitor(x, y))
}
fn meet_all_mut<'a, F, Rhs>(&'a mut self, rhs: Rhs, mut visitor: F)
where
Rhs: Copy,
F: FnMut(&'a mut T, Rhs),
T: 'a
{
self.enumerate_meet_all_mut(rhs, |_, x, y| visitor(x, y))
}
fn meet_all_pin<'a, F, Rhs>(self: Pin<&'a Self>, rhs: Rhs, mut visitor: F)
where
Rhs: Copy,
F: FnMut(Pin<&'a T>, Rhs),
T: 'a
{
self.enumerate_meet_all_pin(rhs, |_, x, y| visitor(x, y))
}
fn meet_all_pin_mut<'a, F, Rhs>(self: Pin<&'a mut Self>, rhs: Rhs, mut visitor: F)
where
Rhs: Copy,
F: FnMut(Pin<&'a mut T>, Rhs),
T: 'a
{
self.enumerate_meet_all_pin_mut(rhs, |_, x, y| visitor(x, y))
}
fn try_meet_all<'a, E, F, Rhs>(&'a self, rhs: Rhs, mut visitor: F) -> Result<(), E>
where
Rhs: Copy,
F: FnMut(&'a T, Rhs) -> Result<(), E>,
T: 'a
{
self.try_enumerate_meet_all(rhs, |_, x, y| visitor(x, y))
}
fn try_meet_all_mut<'a, E, F, Rhs>(&'a mut self, rhs: Rhs, mut visitor: F) -> Result<(), E>
where
Rhs: Copy,
F: FnMut(&'a mut T, Rhs) -> Result<(), E>,
T: 'a
{
self.try_enumerate_meet_all_mut(rhs, |_, x, y| visitor(x, y))
}
fn try_meet_all_pin<'a, E, F, Rhs>(self: Pin<&'a Self>, rhs: Rhs, mut visitor: F) -> Result<(), E>
where
Rhs: Copy,
F: FnMut(Pin<&'a T>, Rhs) -> Result<(), E>,
T: 'a
{
self.try_enumerate_meet_all_pin(rhs, |_, x, y| visitor(x, y))
}
fn try_meet_all_pin_mut<'a, E, F, Rhs>(self: Pin<&'a mut Self>, rhs: Rhs, mut visitor: F) -> Result<(), E>
where
Rhs: Copy,
F: FnMut(Pin<&'a mut T>, Rhs) -> Result<(), E>,
T: 'a
{
self.try_enumerate_meet_all_pin_mut(rhs, |_, x, y| visitor(x, y))
}
fn rmeet_all<'a, F, Rhs>(&'a self, rhs: Rhs, mut visitor: F)
where
Rhs: Copy,
F: FnMut(&'a T, Rhs),
T: 'a
{
self.enumerate_rmeet_all(rhs, |_, x, y| visitor(x, y))
}
fn rmeet_all_mut<'a, F, Rhs>(&'a mut self, rhs: Rhs, mut visitor: F)
where
Rhs: Copy,
F: FnMut(&'a mut T, Rhs),
T: 'a
{
self.enumerate_rmeet_all_mut(rhs, |_, x, y| visitor(x, y))
}
fn rmeet_all_pin<'a, F, Rhs>(self: Pin<&'a Self>, rhs: Rhs, mut visitor: F)
where
Rhs: Copy,
F: FnMut(Pin<&'a T>, Rhs),
T: 'a
{
self.enumerate_rmeet_all_pin(rhs, |_, x, y| visitor(x, y))
}
fn rmeet_all_pin_mut<'a, F, Rhs>(self: Pin<&'a mut Self>, rhs: Rhs, mut visitor: F)
where
Rhs: Copy,
F: FnMut(Pin<&'a mut T>, Rhs),
T: 'a
{
self.enumerate_rmeet_all_pin_mut(rhs, |_, x, y| visitor(x, y))
}
fn try_rmeet_all<'a, E, F, Rhs>(&'a self, rhs: Rhs, mut visitor: F) -> Result<(), E>
where
Rhs: Copy,
F: FnMut(&'a T, Rhs) -> Result<(), E>,
T: 'a
{
self.try_enumerate_rmeet_all(rhs, |_, x, y| visitor(x, y))
}
fn try_rmeet_all_mut<'a, E, F, Rhs>(&'a mut self, rhs: Rhs, mut visitor: F) -> Result<(), E>
where
Rhs: Copy,
F: FnMut(&'a mut T, Rhs) -> Result<(), E>,
T: 'a
{
self.try_enumerate_rmeet_all_mut(rhs, |_, x, y| visitor(x, y))
}
fn try_rmeet_all_pin<'a, E, F, Rhs>(self: Pin<&'a Self>, rhs: Rhs, mut visitor: F) -> Result<(), E>
where
Rhs: Copy,
F: FnMut(Pin<&'a T>, Rhs) -> Result<(), E>,
T: 'a
{
self.try_enumerate_rmeet_all_pin(rhs, |_, x, y| visitor(x, y))
}
fn try_rmeet_all_pin_mut<'a, E, F, Rhs>(self: Pin<&'a mut Self>, rhs: Rhs, mut visitor: F) -> Result<(), E>
where
Rhs: Copy,
F: FnMut(Pin<&'a mut T>, Rhs) -> Result<(), E>,
T: 'a
{
self.try_enumerate_rmeet_all_pin_mut(rhs, |_, x, y| visitor(x, y))
}
async fn meet_all_async<'a, F, Rhs>(&'a self, rhs: Rhs, visitor: F)
where
Rhs: Copy,
F: AsyncFn(&'a T, Rhs),
T: 'a
{
self.enumerate_meet_all_async(rhs, |_, x, y| visitor(x, y)).await
}
async fn meet_all_mut_async<'a, F, Rhs>(&'a mut self, rhs: Rhs, visitor: F)
where
Rhs: Copy,
F: AsyncFn(&'a mut T, Rhs),
T: 'a
{
self.enumerate_meet_all_mut_async(rhs, |_, x, y| visitor(x, y)).await
}
async fn meet_all_pin_async<'a, F, Rhs>(self: Pin<&'a Self>, rhs: Rhs, visitor: F)
where
Rhs: Copy,
F: AsyncFn(Pin<&'a T>, Rhs),
T: 'a
{
self.enumerate_meet_all_pin_async(rhs, |_, x, y| visitor(x, y)).await
}
async fn meet_all_pin_mut_async<'a, F, Rhs>(self: Pin<&'a mut Self>, rhs: Rhs, visitor: F)
where
Rhs: Copy,
F: AsyncFn(Pin<&'a mut T>, Rhs),
T: 'a
{
self.enumerate_meet_all_pin_mut_async(rhs, |_, x, y| visitor(x, y)).await
}
async fn try_meet_all_async<'a, E, F, Rhs>(&'a self, rhs: Rhs, visitor: F) -> Result<(), E>
where
Rhs: Copy,
F: AsyncFn(&'a T, Rhs) -> Result<(), E>,
T: 'a
{
self.try_enumerate_meet_all_async(rhs, |_, x, y| visitor(x, y)).await
}
async fn try_meet_all_mut_async<'a, E, F, Rhs>(&'a mut self, rhs: Rhs, visitor: F) -> Result<(), E>
where
Rhs: Copy,
F: AsyncFn(&'a mut T, Rhs) -> Result<(), E>,
T: 'a
{
self.try_enumerate_meet_all_mut_async(rhs, |_, x, y| visitor(x, y)).await
}
async fn try_meet_all_pin_async<'a, E, F, Rhs>(self: Pin<&'a Self>, rhs: Rhs, visitor: F) -> Result<(), E>
where
Rhs: Copy,
F: AsyncFn(Pin<&'a T>, Rhs) -> Result<(), E>,
T: 'a
{
self.try_enumerate_meet_all_pin_async(rhs, |_, x, y| visitor(x, y)).await
}
async fn try_meet_all_pin_mut_async<'a, E, F, Rhs>(self: Pin<&'a mut Self>, rhs: Rhs, visitor: F) -> Result<(), E>
where
Rhs: Copy,
F: AsyncFn(Pin<&'a mut T>, Rhs) -> Result<(), E>,
T: 'a
{
self.try_enumerate_meet_all_pin_mut_async(rhs, |_, x, y| visitor(x, y)).await
}
}
#[cfg(test)]
mod test
{
use crate::ops::ArrayMeet;
#[test]
fn it_works()
{
let x = [1, 2, 3, 4, 5, 6, 7, 8];
let y = [1, 2, 3, 4, -1, -2, -3, -4];
tokio_test::block_on(async {
let result = x.try_meet_each_async(y, async |&a, b| {
if b < 0
{
return Err(b)
}
assert_eq!(x[a as usize - 1], a);
assert_eq!(y[b as usize - 1], b);
assert_eq!(a, b);
Ok(())
}).await;
assert!(result == Err(-1) || result == Err(-2) || result == Err(-3) || result == Err(-4));
})
}
}