SelectMode, GroupHeads, PresetRowMenu and Selection are memo props, for the presets browser's memoized view

This commit is contained in:
bflatastic
2026-11-22 01:41:12 +07:00
parent 495f8bb53b
commit 0f9af5527c
4 changed files with 13 additions and 3 deletions
@@ -11,7 +11,7 @@ use std::any::Any;
use std::sync::Arc;
/// What a collection lets the user select.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, crate::contract::MemoProps)]
#[non_exhaustive]
pub enum SelectMode {
/// Nothing; the lead still moves.
+10
View File
@@ -843,6 +843,16 @@ impl<T: MemoProps> MemoProps for craft_behavior::Mixed<T> {
}
/// The translator (`Words::generation`): words with the same generation read every word the same.
/// Every field (`#[non_exhaustive]`, so a field added later is listed here by hand): the selected keys, the lead and
/// the anchor.
impl<K: MemoProps> MemoProps for craft_behavior::Selection<K> {
fn key(&self, key: &mut MemoKey) {
self.items.key(key);
self.lead.key(key);
self.anchor.key(key);
}
}
impl MemoProps for craft_i18n::Words {
fn key(&self, key: &mut MemoKey) {
self.generation().key(key);
@@ -144,7 +144,7 @@ pub struct PresetRow<K> {
}
/// What the row menu of a browser or picker shows.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq)]
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, crate::contract::MemoProps)]
#[non_exhaustive]
pub enum PresetRowMenu {
/// Rename, Move to, Delete, a divider, then the host's `row_items`.
+1 -1
View File
@@ -289,7 +289,7 @@ pub struct TileGrid<'a, K: Clone + Eq + Hash + Send + Sync + 'static> {
}
/// How the groups of a grid or a list are set apart.
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash)]
#[derive(Clone, Copy, Debug, Default, PartialEq, Eq, Hash, crate::contract::MemoProps)]
#[non_exhaustive]
pub enum GroupHeads {
/// Every group has its titled head.