use Derivative for implementing Default on Loadable
+use derivative::Derivative;
use serde::Serialize;
-#[derive(Clone, PartialEq, Serialize)]
+#[derive(Derivative, Clone, PartialEq, Serialize)]
+#[derivative(Default)]
#[serde(tag = "type", content = "content")]
pub enum Loadable<R, E> {
+ #[derivative(Default)]
Loading,
Ready(R),
Err(E),
}
-
-impl<R, E> Default for Loadable<R, E> {
- fn default() -> Self {
- Loadable::Loading
- }
-}
