libwmctl/model/
gravity.rs1use std::fmt;
2
3#[derive(Debug, Clone, PartialEq)]
11pub enum Gravity {
12 Unmap,
13 Center,
14}
15
16impl fmt::Display for Gravity {
18 fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
19 match self {
20 _ => write!(f, "{}", format!("{:?}", self).to_lowercase()),
21 }
22 }
23}
24
25impl From<u32> for Gravity {
26 fn from(val: u32) -> Self {
27 match val {
28 5 => Gravity::Center,
29 _ => Gravity::Unmap,
30 }
31 }
32}
33
34impl From<Gravity> for u32 {
35 fn from(val: Gravity) -> Self {
36 match val {
37 Gravity::Center => 5,
38 Gravity::Unmap => 0,
39 }
40 }
41}