cosmic/surface/
mod.rs
1pub mod action;
5
6use iced::Limits;
7use iced::Size;
8use iced::Task;
9use std::future::Future;
10use std::sync::Arc;
11
12#[derive(Clone)]
14pub enum Action {
15 AppSubsurface(
17 std::sync::Arc<Box<dyn std::any::Any + Send + Sync>>,
18 Option<std::sync::Arc<Box<dyn std::any::Any + Send + Sync>>>,
19 ),
20 Subsurface(
22 std::sync::Arc<Box<dyn std::any::Any + Send + Sync>>,
23 Option<std::sync::Arc<Box<dyn std::any::Any + Send + Sync>>>,
24 ),
25 DestroySubsurface(iced::window::Id),
27 AppPopup(
29 std::sync::Arc<Box<dyn std::any::Any + Send + Sync>>,
30 Option<std::sync::Arc<Box<dyn std::any::Any + Send + Sync>>>,
31 ),
32 Popup(
34 std::sync::Arc<Box<dyn std::any::Any + Send + Sync>>,
35 Option<std::sync::Arc<Box<dyn std::any::Any + Send + Sync>>>,
36 ),
37 DestroyPopup(iced::window::Id),
39 ResponsiveMenuBar {
41 menu_bar: crate::widget::Id,
43 limits: Limits,
45 size: Size,
47 },
48 Ignore,
49 Task(Arc<dyn Fn() -> Task<Action> + Send + Sync>),
50}
51
52impl std::fmt::Debug for Action {
53 #[cold]
54 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
55 match self {
56 Self::AppSubsurface(arg0, arg1) => f
57 .debug_tuple("AppSubsurface")
58 .field(arg0)
59 .field(arg1)
60 .finish(),
61 Self::Subsurface(arg0, arg1) => {
62 f.debug_tuple("Subsurface").field(arg0).field(arg1).finish()
63 }
64 Self::DestroySubsurface(arg0) => {
65 f.debug_tuple("DestroySubsurface").field(arg0).finish()
66 }
67 Self::AppPopup(arg0, arg1) => {
68 f.debug_tuple("AppPopup").field(arg0).field(arg1).finish()
69 }
70 Self::Popup(arg0, arg1) => f.debug_tuple("Popup").field(arg0).field(arg1).finish(),
71 Self::DestroyPopup(arg0) => f.debug_tuple("DestroyPopup").field(arg0).finish(),
72 Self::ResponsiveMenuBar {
73 menu_bar,
74 limits,
75 size,
76 } => f
77 .debug_struct("ResponsiveMenuBar")
78 .field("menu_bar", menu_bar)
79 .field("limits", limits)
80 .field("size", size)
81 .finish(),
82 Self::Ignore => write!(f, "Ignore"),
83 Self::Task(_) => f.debug_tuple("Future").finish(),
84 }
85 }
86}