1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
|
use crate::dot::DotString;
use std::borrow::Cow;
pub enum ImagePosition {
TopLeft,
TopCentered,
TopRight,
MiddleLeft,
MiddleCentered,
MiddleRight,
BottomLeft,
BottomCentered,
BottomRight,
}
impl<'a> DotString<'a> for ImagePosition {
fn dot_string(&self) -> Cow<'a, str> {
match self {
ImagePosition::TopLeft => "tl".into(),
ImagePosition::TopCentered => "tc".into(),
ImagePosition::TopRight => "tr".into(),
ImagePosition::MiddleLeft => "ml".into(),
ImagePosition::MiddleCentered => "mc".into(),
ImagePosition::MiddleRight => "mr".into(),
ImagePosition::BottomLeft => "bl".into(),
ImagePosition::BottomCentered => "bc".into(),
ImagePosition::BottomRight => "br".into(),
}
}
}
pub enum ImageScale {
Width,
Height,
Both,
}
impl<'a> DotString<'a> for ImageScale {
fn dot_string(&self) -> Cow<'a, str> {
match self {
ImageScale::Width => "width".into(),
ImageScale::Height => "height".into(),
ImageScale::Both => "both".into(),
}
}
}
|