freya_core/style/
text_overflow.rs1#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
3#[derive(Default, Clone, Debug, PartialEq, Hash)]
4pub enum TextOverflow {
5 #[default]
7 Clip,
8 Ellipsis,
10 Custom(String),
12}
13
14impl TextOverflow {
15 pub fn get_ellipsis(&self) -> Option<&str> {
16 match self {
17 Self::Clip => None,
18 Self::Ellipsis => Some("…"),
19 Self::Custom(custom) => Some(custom),
20 }
21 }
22
23 pub fn pretty(&self) -> String {
24 match self {
25 TextOverflow::Clip => "clip".to_string(),
26 TextOverflow::Ellipsis => "ellipsis".to_string(),
27 TextOverflow::Custom(text_overflow) => text_overflow.to_string(),
28 }
29 }
30}