1use crate::Scale;
2use std::fmt::{Debug, Display, Formatter};
3
4#[derive(Copy, Clone, Eq, PartialEq, Hash, Default)]
6pub struct Loc {
7 pub x: Scale,
8 pub y: Scale,
9}
10
11impl Loc {
12 pub const fn new(x: Scale, y: Scale) -> Self {
16 Self { x, y }
17 }
18}
19
20impl From<(Scale, Scale)> for Loc {
21 fn from((x, y): (Scale, Scale)) -> Self {
22 Self { x, y }
23 }
24}
25
26impl Debug for Loc {
27 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
28 write!(f, "{}", self)
29 }
30}
31
32impl Display for Loc {
33 fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result {
34 write!(f, "({}, {})", self.x, self.y)
35 }
36}