mirror of
https://github.com/storytold/craft-libs.git
synced 2026-11-26 03:17:43 +00:00
craft-theme: LabelColor is plain data and memo props
craft-layers no longer marks its LabelColor fields: the type derives PlainData in craft-theme (a tier-0 crate, as craft-behavior is), and the contract crate keys it as it keys the other theme types.
This commit is contained in:
Generated
+2
@@ -4152,6 +4152,8 @@ name = "craft-theme"
|
||||
version = "0.1.0"
|
||||
dependencies = [
|
||||
"bitflags 2.13.2",
|
||||
"craft-tracked",
|
||||
"craft-ui-macros",
|
||||
"ecolor",
|
||||
"log",
|
||||
"proptest",
|
||||
|
||||
@@ -354,7 +354,6 @@ pub struct LayerFilter {
|
||||
/// Color: the label colour; `None` (no label) at first. Serialized by name (`"none"`, `"red"`,
|
||||
/// … `"gray"`).
|
||||
#[serde(with = "label_name")]
|
||||
#[memo_props(hash = "a plain enum with a derived Hash")]
|
||||
pub color: Option<LabelColor>,
|
||||
/// Smart Object: the kinds toggled on, in the order they were toggled.
|
||||
pub smart: Vec<SmartKind>,
|
||||
|
||||
@@ -127,7 +127,6 @@ pub struct LayerInfo {
|
||||
/// Whether the row draws faint: hidden itself or inside a hidden group (the app decides).
|
||||
pub dimmed: bool,
|
||||
/// The label colour that fills the eye cell; `None` for none.
|
||||
#[plain_data(assume = "a plain Copy enum of colours")]
|
||||
pub label: Option<LabelColor>,
|
||||
/// The layer's locks: any of them shows the lock indicator.
|
||||
pub locks: LayerLocks,
|
||||
|
||||
@@ -10,6 +10,8 @@ repository.workspace = true
|
||||
|
||||
[dependencies]
|
||||
bitflags = { workspace = true }
|
||||
craft-tracked = { workspace = true }
|
||||
craft-ui-macros = { workspace = true }
|
||||
ecolor = { workspace = true }
|
||||
serde = { workspace = true }
|
||||
smallvec = { workspace = true }
|
||||
|
||||
@@ -330,7 +330,7 @@ pub struct BorderColors {
|
||||
}
|
||||
|
||||
/// PhotoCraft's layer label colours (`LabelColor`).
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord)]
|
||||
#[derive(Clone, Copy, Debug, PartialEq, Eq, Hash, PartialOrd, Ord, craft_ui_macros::PlainData)]
|
||||
pub enum LabelColor {
|
||||
#[allow(missing_docs)]
|
||||
Red,
|
||||
|
||||
@@ -958,6 +958,13 @@ impl MemoProps for craft_theme::variant::Tone {
|
||||
}
|
||||
}
|
||||
|
||||
/// Derived `Hash` over a unit enum.
|
||||
impl MemoProps for craft_theme::LabelColor {
|
||||
fn key(&self, key: &mut MemoKey) {
|
||||
key.feed_hash(self);
|
||||
}
|
||||
}
|
||||
|
||||
impl MemoProps for craft_behavior::IconId {
|
||||
fn key(&self, key: &mut MemoKey) {
|
||||
// The name is the whole id.
|
||||
|
||||
Reference in New Issue
Block a user