add some extra derive's to various structs

This commit is contained in:
Gered 2022-07-16 16:52:43 -04:00
parent 5b2a3c9cb6
commit d06ae1837b
6 changed files with 7 additions and 14 deletions

View file

@ -11,7 +11,7 @@ pub enum AudioBufferError {
} }
/// Holds audio sample data that can be played via [`AudioDevice`]. /// Holds audio sample data that can be played via [`AudioDevice`].
#[derive(Debug, Clone)] #[derive(Debug, Clone, Eq, PartialEq)]
pub struct AudioBuffer { pub struct AudioBuffer {
spec: AudioSpec, spec: AudioSpec,
pub data: Vec<u8>, pub data: Vec<u8>,

View file

@ -40,7 +40,7 @@ pub enum BitmapError {
/// one row to the next is always exactly equal to the bitmap width. Rendering operations provided /// one row to the next is always exactly equal to the bitmap width. Rendering operations provided
/// here are done with respect to the bitmaps clipping region, where rendering outside of the /// here are done with respect to the bitmaps clipping region, where rendering outside of the
/// clipping region is simply not performed / stops at the clipping boundary. /// clipping region is simply not performed / stops at the clipping boundary.
#[derive(Debug, Clone)] #[derive(Debug, Clone, Eq, PartialEq)]
pub struct Bitmap { pub struct Bitmap {
width: u32, width: u32,
height: u32, height: u32,

View file

@ -11,7 +11,7 @@ pub enum BitmapAtlasError {
OutOfBounds, OutOfBounds,
} }
#[derive(Debug)] #[derive(Debug, Clone, Eq, PartialEq)]
pub struct BitmapAtlas { pub struct BitmapAtlas {
bitmap: Bitmap, bitmap: Bitmap,
bounds: Rect, bounds: Rect,

View file

@ -43,7 +43,7 @@ pub trait Font {
fn measure(&self, text: &str, opts: FontRenderOpts) -> (u32, u32); fn measure(&self, text: &str, opts: FontRenderOpts) -> (u32, u32);
} }
#[derive(Debug)] #[derive(Debug, Clone, Eq, PartialEq)]
pub struct BitmaskCharacter { pub struct BitmaskCharacter {
bytes: [u8; CHAR_HEIGHT], bytes: [u8; CHAR_HEIGHT],
bounds: Rect, bounds: Rect,
@ -83,7 +83,7 @@ impl Character for BitmaskCharacter {
} }
} }
#[derive(Debug)] #[derive(Debug, Clone, Eq, PartialEq)]
pub struct BitmaskFont { pub struct BitmaskFont {
characters: Box<[BitmaskCharacter]>, characters: Box<[BitmaskCharacter]>,
line_height: u8, line_height: u8,

View file

@ -189,7 +189,7 @@ pub enum PaletteFormat {
/// Contains a 256 color palette, and provides methods useful for working with palettes. The /// Contains a 256 color palette, and provides methods useful for working with palettes. The
/// colors are all stored individually as 32-bit packed values in the format 0xAARRGGBB. /// colors are all stored individually as 32-bit packed values in the format 0xAARRGGBB.
#[derive(Debug, Clone)] #[derive(Debug, Clone, Eq, PartialEq)]
pub struct Palette { pub struct Palette {
colors: [u32; NUM_COLORS], colors: [u32; NUM_COLORS],
} }
@ -495,13 +495,6 @@ impl IndexMut<u8> for Palette {
} }
} }
impl PartialEq for Palette {
#[inline]
fn eq(&self, other: &Self) -> bool {
self.colors == other.colors
}
}
#[cfg(test)] #[cfg(test)]
mod tests { mod tests {
use tempfile::TempDir; use tempfile::TempDir;

View file

@ -3,7 +3,7 @@ use std::ops::{Mul, MulAssign};
use crate::math::*; use crate::math::*;
/// Represents a 3x3 column-major matrix and provides common methods for matrix math. /// Represents a 3x3 column-major matrix and provides common methods for matrix math.
#[derive(Debug, Copy, Clone)] #[derive(Debug, Copy, Clone, PartialEq)]
pub struct Matrix3x3 { pub struct Matrix3x3 {
pub m: [f32; 9], pub m: [f32; 9],
} }