1#![feature(specialization)]
2#![feature(never_type)]
3
4pub mod attrs;
5pub mod nodes;
6
7pub mod easing;
8
9#[cfg(feature = "dynamic")]
10pub mod dynamic {
11 use serde::de::DeserializeOwned;
12
13 use photonic::attr::Bounded;
14 use photonic::{input, AttrValue};
15 use photonic_dynamic::factory::{factory, BoundAttrFactory, FreeAttrFactory, NodeFactory};
16 use photonic_dynamic::registry;
17
18 pub struct Registry;
19
20 impl registry::Registry for Registry {
21 fn node<Reg: registry::Registry>(kind: &str) -> Option<NodeFactory<Reg>> {
22 return Some(match kind {
23 "alert" => factory::<crate::nodes::alert::dynamic::Config>(),
24 "blackout" => factory::<crate::nodes::blackout::dynamic::Config>(),
25 "brightness" => factory::<crate::nodes::brightness::dynamic::Config>(),
26 "color-wheel" => factory::<crate::nodes::color_wheel::dynamic::Config>(),
27 "larson" => factory::<crate::nodes::larson::dynamic::Config>(),
28 "noise" => factory::<crate::nodes::noise::dynamic::Config>(),
29 "overlay" => factory::<crate::nodes::overlay::dynamic::Config>(),
30 "raindrops" => factory::<crate::nodes::raindrops::dynamic::Config>(),
31 "select" => factory::<crate::nodes::select::dynamic::Config>(),
32 "solid" => factory::<crate::nodes::solid::dynamic::Config>(),
33 "splice" => factory::<crate::nodes::splice::dynamic::Config>(),
34 _ => return None,
35 });
36 }
37
38 fn free_attr<Reg: registry::Registry, V>(kind: &str) -> Option<FreeAttrFactory<Reg, V>>
39 where V: AttrValue + DeserializeOwned + input::Coerced {
40 return Some(match kind {
41 "button" => factory::<crate::attrs::button::dynamic::Config<V>>(),
42 "switch" => factory::<crate::attrs::switch::dynamic::Config<V>>(),
43 "fader" => factory::<crate::attrs::fader::dynamic::Config<V>>(),
44 "sequence" => factory::<crate::attrs::sequence::dynamic::Config<V>>(),
45 "peak" => factory::<crate::attrs::peak::dynamic::Config<V>>(),
46 _ => crate::attrs::color::free_attr(kind)?,
47 });
48 }
49
50 fn bound_attr<Reg: registry::Registry, V>(kind: &str) -> Option<BoundAttrFactory<Reg, V>>
51 where V: AttrValue + DeserializeOwned + input::Coerced + Bounded {
52 return Some(match kind {
53 "button" => factory::<crate::attrs::button::dynamic::Config<V>>(),
54 "switch" => factory::<crate::attrs::switch::dynamic::Config<V>>(),
55 "fader" => factory::<crate::attrs::fader::dynamic::Config<V>>(),
56 "looper" => factory::<crate::attrs::looper::dynamic::Config<V>>(),
57 "noise" => factory::<crate::attrs::noise::dynamic::Config>(),
58 "random" => factory::<crate::attrs::random::dynamic::Config>(),
59 "sequence" => factory::<crate::attrs::sequence::dynamic::Config<V>>(),
60 "peak" => factory::<crate::attrs::peak::dynamic::Config<V>>(),
61 _ => return None,
62 });
63 }
64 }
65}