egui_charts/ui/dialogs/indicator_dialog/
actions.rs1use crate::studies::Indicator;
4
5#[derive(Clone)]
7#[non_exhaustive]
8pub enum IndicatorDialogAction {
9 None,
11 AddIndicator(Box<dyn Indicator>),
14 ToggleFavorite(String),
16 Close,
18}
19
20impl std::fmt::Debug for IndicatorDialogAction {
21 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
22 match self {
23 Self::None => f.write_str("None"),
24 Self::AddIndicator(study) => {
25 f.debug_tuple("AddIndicator").field(&study.name()).finish()
26 }
27 Self::ToggleFavorite(name) => f.debug_tuple("ToggleFavorite").field(name).finish(),
28 Self::Close => f.write_str("Close"),
29 }
30 }
31}
32
33impl IndicatorDialogAction {
34 pub fn is_add(&self) -> bool {
36 matches!(self, IndicatorDialogAction::AddIndicator(_))
37 }
38}