summaryrefslogtreecommitdiff
path: root/iced_builder/src/types
diff options
context:
space:
mode:
Diffstat (limited to 'iced_builder/src/types')
-rw-r--r--iced_builder/src/types/element_name.rs12
-rwxr-xr-xiced_builder/src/types/rendered_element.rs14
2 files changed, 13 insertions, 13 deletions
diff --git a/iced_builder/src/types/element_name.rs b/iced_builder/src/types/element_name.rs
index 8d00814..93e12a1 100644
--- a/iced_builder/src/types/element_name.rs
+++ b/iced_builder/src/types/element_name.rs
@@ -3,7 +3,7 @@ use serde::{Deserialize, Serialize};
use crate::Error;
use super::rendered_element::{
- button, column, container, image, row, svg, text, ActionKind, RenderedElement,
+ button, column, container, image, row, svg, text, Action, RenderedElement,
};
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
@@ -31,7 +31,7 @@ impl ElementName {
pub fn handle_action(
&self,
element_tree: Option<&mut RenderedElement>,
- action: ActionKind,
+ action: Action,
) -> Result<Option<RenderedElement>, Error> {
let element = match self {
Self::Text(_) => text(""),
@@ -43,9 +43,9 @@ impl ElementName {
Self::Column => column(None),
};
match action {
- ActionKind::Stop => Ok(None),
- ActionKind::AddNew => Ok(Some(element)),
- ActionKind::PushFront(id) => {
+ Action::Stop => Ok(None),
+ Action::AddNew => Ok(Some(element)),
+ Action::PushFront(id) => {
element_tree
.ok_or("The action was of kind `PushFront`, but no element tree was provided.")?
.find_by_id(id)
@@ -53,7 +53,7 @@ impl ElementName {
.push_front(&element);
Ok(None)
}
- ActionKind::InsertAfter(parent_id, child_id) => {
+ Action::InsertAfter(parent_id, child_id) => {
element_tree
.ok_or(
"The action was of kind `InsertAfter`, but no element tree was provided.",
diff --git a/iced_builder/src/types/rendered_element.rs b/iced_builder/src/types/rendered_element.rs
index 50e591a..08d7ba3 100755
--- a/iced_builder/src/types/rendered_element.rs
+++ b/iced_builder/src/types/rendered_element.rs
@@ -120,16 +120,16 @@ impl RenderedElement {
pub fn handle_action(
&self,
element_tree: Option<&mut RenderedElement>,
- action: ActionKind,
+ action: Action,
) -> Result<(), Error> {
let element_tree = element_tree.unwrap();
match action {
- ActionKind::Stop => Ok(()),
- ActionKind::AddNew => Err(
+ Action::Stop => Ok(()),
+ Action::AddNew => Err(
"the action was of kind `AddNew`, but invoking it on an existing element tree is not possible".into(),
),
- ActionKind::PushFront(id) => {
+ Action::PushFront(id) => {
let old_parent = element_tree.find_parent(self).unwrap();
old_parent.remove(self);
@@ -138,7 +138,7 @@ impl RenderedElement {
Ok(())
}
- ActionKind::InsertAfter(parent_id, target_id) => {
+ Action::InsertAfter(parent_id, target_id) => {
let old_parent = element_tree.find_parent(self).unwrap();
old_parent.remove(self);
@@ -300,14 +300,14 @@ impl std::fmt::Display for RenderedElement {
}
#[derive(Debug, Clone)]
-pub enum ActionKind {
+pub enum Action {
AddNew,
PushFront(Id),
InsertAfter(Id, Id),
Stop,
}
-impl ActionKind {
+impl Action {
pub fn new(
ids: Vec<Id>,
element_tree: &mut Option<RenderedElement>,