Loadable now implements SignalGetCopy.

This commit is contained in:
2024-03-04 20:55:05 +00:00
parent 074935e425
commit 579df3eaa8

View File

@@ -6,6 +6,8 @@ use std::{
ops::{ControlFlow, FromResidual, Try},
};
use dynatos_reactive::SignalGetCopy;
/// Loadable value.
#[derive(Clone, Copy, Debug)]
pub enum Loadable<T, E> {
@@ -208,6 +210,12 @@ where
}
}
impl<T: Copy, E> SignalGetCopy<Loadable<T, E>> for Loadable<&'_ T, E> {
fn copy(self) -> Loadable<T, E> {
self.map(|value| *value)
}
}
/// Extension trait for iterators of `Loadable<T, E>`
#[extend::ext(name = IteratorLoadableExt)]
pub impl<I, T, E> I