ferroui_android/automation/
i_node_info_provider.rs1use super::node_info::NodeInfo;
2use ferroui_controls::automation::ElementNotEnabledException;
3
4#[derive(Clone, Debug, Default, PartialEq, Eq)]
7pub struct NodeActionArguments {
8 pub set_text_char_sequence: Option<String>,
10}
11
12#[derive(Debug)]
15pub enum NodeActionError {
16 ElementNotEnabled(ElementNotEnabledException),
18 InvalidOperation(String),
20 NotSupported(String),
22}
23
24impl From<ElementNotEnabledException> for NodeActionError {
25 fn from(error: ElementNotEnabledException) -> Self {
26 Self::ElementNotEnabled(error)
27 }
28}
29
30impl std::fmt::Display for NodeActionError {
31 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
32 match self {
33 Self::ElementNotEnabled(_) => f.write_str("Element not enabled."),
34 Self::InvalidOperation(message) | Self::NotSupported(message) => f.write_str(message),
35 }
36 }
37}
38
39impl std::error::Error for NodeActionError {}
40
41pub trait INodeInfoProvider {
42 fn virtual_view_id(&self) -> i32;
43
44 fn perform_node_action(&self, action: i32, arguments: Option<&NodeActionArguments>) -> Result<bool, NodeActionError>;
45
46 fn populate_node_info(&self, node_info: &mut NodeInfo) -> Result<(), NodeActionError>;
47}