MemoProps by the derive where it expresses the key; the tool rail trials' rooms are trial rooms

ShapePreset derives (a fieldless enum: its variant), UnderVeil and the gallery card's Look
derive with their foreign fields keyed by Hash. The rail trials' fixture room is exempt from
literal-size as the iconic column trials' are.
This commit is contained in:
aiongg committed 2026-11-20 14:08:58 +00:00
1 parent 31bda8a4fb
commit 6575942aed
6 files changed
+20 -24

No files matched your search

+1
View File
@@ -32,6 +32,7 @@ const HEART_POINTS: usize = 32;
/// One entry of the shape menu.
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash)]
#[cfg_attr(feature = "ui", derive(craft_ui::contract::MemoProps))]
#[non_exhaustive]
pub enum ShapePreset {
/// A rectangle.
-7
View File
@@ -84,13 +84,6 @@ impl ShapePreset {
}
}
/// A preset glyph keys by its preset: a fieldless enum whose derived `Hash` is its variant.
impl craft_ui::contract::MemoProps for ShapePreset {
fn key(&self, key: &mut craft_ui::contract::MemoKey) {
key.feed_hash(self);
}
}
/// Presets never mirror: each glyph shows the document shape its tool creates, and document geometry does not follow
/// the reading direction.
impl Glyph for ShapePreset {
@@ -27,14 +27,8 @@ pub(crate) struct Fade {
/// The layer whose open veil the components shown here lie under: set by `PaintUi` for the children a faded
/// component shows while its paint runs, which its veil covers.
#[derive(Clone, Copy, Debug, PartialEq, Eq)]
pub(crate) struct UnderVeil(pub Option<Layer>);
impl crate::contract::MemoProps for UnderVeil {
fn key(&self, key: &mut crate::contract::MemoKey) {
key.feed_hash(&self.0);
}
}
#[derive(Clone, Copy, Debug, PartialEq, Eq, crate::contract::MemoProps)]
pub(crate) struct UnderVeil(#[memo_props(hash = "an egui layer id is its order and id")] pub Option<Layer>);
impl EnvValue for UnderVeil {
fn root() -> Self {
+4 -9
View File
@@ -45,25 +45,20 @@ pub enum CardCommands {
}
/// The appearance values a card sets for its story beyond the window's.
#[derive(Clone, Copy, Debug, Default, PartialEq)]
#[derive(Clone, Copy, Debug, Default, PartialEq, MemoProps)]
#[non_exhaustive]
pub struct Look {
/// The mode the story's tokens resolve in.
#[memo_props(hash = "a fieldless enum of the theme")]
pub mode: Option<Mode>,
/// The layout direction.
#[memo_props(hash = "a fieldless enum of the i18n crate")]
pub direction: Option<Direction>,
/// The control size.
#[memo_props(hash = "a fieldless enum of the theme")]
pub size: Option<ControlSize>,
}
/// The theme's own enums, by their derived `Hash`.
impl MemoProps for Look {
fn key(&self, key: &mut craft_ui::contract::MemoKey) {
let Look { mode, direction, size } = *self;
key.feed_hash(&(mode, direction, size));
}
}
/// One story a card shows.
#[non_exhaustive]
pub struct CardStory<'a> {
+5
View File
@@ -7,3 +7,8 @@ deny-unused = true
path = "crates/ui-panels/src/docking/iconic/trials.rs"
rules = ["literal-size"]
reason = "trial rooms, not looks"
[[exempt]]
path = "crates/ui-panels/src/rails/tool/trials.rs"
rules = ["literal-size"]
reason = "trial rooms, not looks"
@@ -7,3 +7,11 @@ rule = "contract/memory"
path = "crates/ui-panels/src/rails/tool/stories.rs"
reason = "The story gives the rail the width of its chosen columns, as a dock column does."
count = 1
[[exception]]
name = "tool-rail-trial-rooms"
kind = "exempt"
rule = "literal-size"
path = "crates/ui-panels/src/rails/tool/trials.rs"
reason = "Trial rooms, not looks."
count = 1