gmaps_static/
relative_position.rs

1use std::fmt;
2
3pub static TOP: RelativePosition = RelativePosition::Top;
4pub static BOTTOM: RelativePosition = RelativePosition::Bottom;
5pub static LEFT: RelativePosition = RelativePosition::Left;
6pub static RIGTH: RelativePosition = RelativePosition::Right;
7pub static CENTER: RelativePosition = RelativePosition::Center;
8pub static TOP_LEFT: RelativePosition = RelativePosition::TopLeft;
9pub static TOP_RIGTH: RelativePosition = RelativePosition::TopRight;
10pub static BOTTOM_LEFT: RelativePosition = RelativePosition::BottomLeft;
11pub static BOTTOM_RIGHT: RelativePosition = RelativePosition::BottomRight;
12
13#[derive(Clone)]
14pub enum RelativePosition {
15    Top,
16    Bottom,
17    Left,
18    Right,
19    Center,
20    TopLeft,
21    TopRight,
22    BottomLeft,
23    BottomRight,
24}
25
26impl fmt::Display for RelativePosition {
27    fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
28        use RelativePosition::*;
29        write!(
30            f,
31            "{}",
32            match self {
33                Top => "top",
34                Bottom => "bottom",
35                Left => "left",
36                Right => "right",
37                Center => "center",
38                TopLeft => "topleft",
39                TopRight => "topright",
40                BottomLeft => "bottomleft",
41                BottomRight => "bottomright",
42            }
43        )
44    }
45}