feat(core): compose effect collections
Support Vec<T: IntoEffect> and [T; N] batches so dynamic reusable partial updates compose inside the existing effect model without a broad IntoIterator blanket impl. req: canonical_authoring/003
This commit is contained in:
@@ -850,6 +850,22 @@ impl<T: IntoEffect> IntoEffect for Option<T> {
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: IntoEffect> IntoEffect for Vec<T> {
|
||||
fn append_to(self, ops: &mut Vec<Effect>) {
|
||||
for effect in self {
|
||||
effect.append_to(ops);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
impl<T: IntoEffect, const N: usize> IntoEffect for [T; N] {
|
||||
fn append_to(self, ops: &mut Vec<Effect>) {
|
||||
for effect in self {
|
||||
effect.append_to(ops);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
macro_rules! impl_tuple_into_effect {
|
||||
($($name:ident $idx:tt),+) => {
|
||||
impl<$($name),+> IntoEffect for ($($name,)+)
|
||||
|
||||
Reference in New Issue
Block a user