Skip to content

Commit 516f663

Browse files
authored
Bits and bobs for #18 (#19)
1 parent 1a74fc8 commit 516f663

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

src/dirs.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ use bitflags::bitflags;
22

33
bitflags! {
44
/// The possible values for a direction in DM.
5+
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
56
pub struct Dirs: u8 {
67
const NORTH = 1 << 0;
78
const SOUTH = 1 << 1;

src/icon.rs

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
use crate::dirs::Dirs;
12
use crate::{error, ztxt, RawDmi};
23
use image::codecs::png;
34
use image::imageops;
@@ -8,13 +9,26 @@ use std::io::Cursor;
89
use std::num::NonZeroU32;
910

1011
#[derive(Clone, Default, PartialEq, Debug)]
12+
/// A DMI Icon, which is a collection of [IconState]s.
1113
pub struct Icon {
1214
pub version: DmiVersion,
1315
pub width: u32,
1416
pub height: u32,
1517
pub states: Vec<IconState>,
1618
}
1719

20+
/// The ordering of directions within a DMI file.
21+
pub const DIR_ORDERING: [Dirs; 8] = [
22+
Dirs::SOUTH,
23+
Dirs::NORTH,
24+
Dirs::EAST,
25+
Dirs::WEST,
26+
Dirs::SOUTHEAST,
27+
Dirs::SOUTHWEST,
28+
Dirs::NORTHEAST,
29+
Dirs::NORTHWEST,
30+
];
31+
1832
impl Icon {
1933
pub fn load<R: Read>(reader: R) -> Result<Icon, error::DmiError> {
2034
let raw_dmi = RawDmi::load(reader)?;

0 commit comments

Comments
 (0)