summaryrefslogtreecommitdiff
path: root/iced_builder/src
diff options
context:
space:
mode:
authorpml68 <contact@pml68.dev>2024-12-28 00:46:11 +0100
committerpml68 <contact@pml68.dev>2024-12-28 00:53:21 +0100
commit714ab9d4376fe890f269e47493691518a4e96289 (patch)
tree376fd1cbeb85091c0447502d91e9ec68439747d6 /iced_builder/src
parentMerge pull request #4 from pml68/feat/playground (diff)
downloadiced-builder-714ab9d4376fe890f269e47493691518a4e96289.tar.gz
refactor!: switch to `uuid` for uuid generation
Existing project files can only be opened after deleting all ids
Diffstat (limited to '')
-rwxr-xr-xiced_builder/src/types/rendered_element.rs11
1 files changed, 6 insertions, 5 deletions
diff --git a/iced_builder/src/types/rendered_element.rs b/iced_builder/src/types/rendered_element.rs
index d4d1a6c..ccc8668 100755
--- a/iced_builder/src/types/rendered_element.rs
+++ b/iced_builder/src/types/rendered_element.rs
@@ -1,9 +1,9 @@
use std::collections::BTreeMap;
-use blob_uuid::random_blob;
use iced::advanced::widget::Id;
use iced::{widget, Element, Length};
use serde::{Deserialize, Serialize};
+use uuid::Uuid;
use super::ElementName;
use crate::types::Message;
@@ -11,7 +11,8 @@ use crate::Result;
#[derive(Debug, Clone, PartialEq, Serialize, Deserialize)]
pub struct RenderedElement {
- id: String,
+ #[serde(skip)]
+ id: Uuid,
child_elements: Option<Vec<RenderedElement>>,
name: ElementName,
options: BTreeMap<String, Option<String>>,
@@ -20,7 +21,7 @@ pub struct RenderedElement {
impl RenderedElement {
fn new(name: ElementName) -> Self {
Self {
- id: random_blob(),
+ id: Uuid::new_v4(),
child_elements: None,
name,
options: BTreeMap::new(),
@@ -29,7 +30,7 @@ impl RenderedElement {
fn with(name: ElementName, child_elements: Vec<RenderedElement>) -> Self {
Self {
- id: random_blob(),
+ id: Uuid::new_v4(),
child_elements: Some(child_elements),
name,
options: BTreeMap::new(),
@@ -37,7 +38,7 @@ impl RenderedElement {
}
pub fn get_id(&self) -> Id {
- Id::new(self.id.clone())
+ Id::new(self.id.to_string())
}
pub fn find_by_id(&mut self, id: Id) -> Option<&mut Self> {