diff --git a/src/pages/word.rs b/src/pages/word.rs index f3443a6..5f01928 100644 --- a/src/pages/word.rs +++ b/src/pages/word.rs @@ -11,7 +11,7 @@ use iced::widget::{button, column, row, rule, scrollable, text}; use iced::{Element, Fill}; use iced_core::Padding; -pub struct WordEditor { +pub struct WordEditor { state: AppState, pub word_handle: EntityHandle, on_delete: Option, @@ -19,13 +19,13 @@ pub struct WordEditor { fields: Vec, } -impl WordEditor { +impl WordEditor { pub(crate) fn update(&mut self, message: WordMessage) -> Option { let dictionary = &mut self.state.dictionary.write(); let word = dictionary.get_mut(&mut self.word_handle).unwrap(); match message { Delete => { - return self.on_delete.take(); + return self.on_delete.clone(); } SetTags(n) => word.tags = n, SetKey(n) => { @@ -44,7 +44,7 @@ impl WordEditor { word.additional.remove(&key); } } - self.on_edit.take() + self.on_edit.clone() } pub(crate) fn view(&self) -> Element<'_, WordMessage> { @@ -108,7 +108,7 @@ impl WordEditor { } } -impl WordEditor { +impl WordEditor { pub fn new(handle: EntityHandle, state: AppState) -> Self { let fields = state .custom_fields @@ -135,7 +135,7 @@ impl WordEditor { } } -impl WordEditor { +impl WordEditor { fn get_view_for_more(&self, value: (&Id, &String)) -> Element<'_, WordMessage> { let field = self.fields.iter().find(|f| f.id == *value.0).unwrap(); match value.0 {