use crate::utils::ByteMask;
use crate::alloc::Allocator;
use crate::PathMap;
use crate::zipper::*;
use crate::morphisms::{into_cata_cached_body, DoCache};
pub trait CatamorphismDebug<V> {
fn into_cata_jumping_cached_fallible_debug<W, E, AlgF>(self, alg_f: AlgF) -> Result<W, E>
where
W: Clone,
AlgF: Fn(&ByteMask, &mut [W], Option<&V>, &[u8], &[u8]) -> Result<W, E>;
}
impl<'a, Z, V: 'a> CatamorphismDebug<V> for Z where Z: Zipper + ZipperReadOnlyConditionalValues<'a, V> + ZipperConcrete + ZipperAbsolutePath + ZipperPathBuffer {
fn into_cata_jumping_cached_fallible_debug<W, E, AlgF>(self, alg_f: AlgF) -> Result<W, E>
where
W: Clone,
AlgF: Fn(&ByteMask, &mut [W], Option<&V>, &[u8], &[u8]) -> Result<W, E>
{
into_cata_cached_body::<Self, V, W, E, _, DoCache, true, true>(self, alg_f)
}
}
impl<V: 'static + Clone + Send + Sync + Unpin, A: Allocator + 'static> CatamorphismDebug<V> for PathMap<V, A> {
fn into_cata_jumping_cached_fallible_debug<W, E, AlgF>(self, alg_f: AlgF) -> Result<W, E>
where
W: Clone,
AlgF: Fn(&ByteMask, &mut [W], Option<&V>, &[u8], &[u8]) -> Result<W, E>
{
let rz = self.into_read_zipper(&[]);
rz.into_cata_jumping_cached_fallible_debug(alg_f)
}
}