bon_macros/normalization/
syntax_variant.rs#[derive(Debug)]
pub(crate) struct SyntaxVariant<T> {
pub(crate) orig: T,
pub(crate) norm: T,
}
impl<T> SyntaxVariant<T> {
pub(crate) fn apply_ref<'a, U>(&'a self, f: impl Fn(&'a T) -> U) -> SyntaxVariant<U> {
let orig = f(&self.orig);
let norm = f(&self.norm);
SyntaxVariant { orig, norm }
}
pub(crate) fn into_iter(self) -> impl Iterator<Item = SyntaxVariant<T::Item>>
where
T: IntoIterator,
{
self.orig
.into_iter()
.zip(self.norm)
.map(|(orig, norm)| SyntaxVariant { orig, norm })
}
}