Skip to content

Commit

Permalink
Add a few simple derives to dmi-related structs (#320)
Browse files Browse the repository at this point in the history
Specifically, add `#[derive(Clone, PartialEq)]` to `dmi::{Metadata, State, Frames}`

As per (very weakly authoritative) <https://rust-lang.github.io/api-guidelines/interoperability.html> one should derive all the std's traits whenever feasible. Currently for my own project I only need `State::Clone`. The `PartialEq` is being added for consistency with it being present on other structs already, and the rest of the `std`'s traits feel a bit like an overkill presently (despite what the guidelines might say)
  • Loading branch information
moxian authored May 18, 2022
1 parent 860d6c4 commit 6f26e07
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions crates/dreammaker/src/dmi.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ impl Default for Dir {
}

/// Embedded metadata describing a DMI spritesheet's layout.
#[derive(Debug)]
#[derive(Debug, Clone, PartialEq)]
pub struct Metadata {
/// The width of the icon in pixels.
pub width: u32,
Expand All @@ -184,7 +184,7 @@ pub struct Metadata {
}

/// The metadata belonging to a single icon state.
#[derive(Debug)]
#[derive(Debug, Clone, PartialEq)]
pub struct State {
/// The state's name, corresponding to the `icon_state` var.
pub name: String,
Expand All @@ -208,7 +208,7 @@ pub enum Dirs {
}

/// How many frames of animation a state has, and their durations.
#[derive(Debug, PartialEq)]
#[derive(Debug, Clone, PartialEq)]
pub enum Frames {
/// Without an explicit setting, only one frame.
One,
Expand Down

0 comments on commit 6f26e07

Please sign in to comment.