StyledString

Struct StyledString 

Source
pub struct StyledString { /* private fields */ }
Expand description

A string with applied TCSS styles.

This struct holds the text content and its associated style.

Implementationsยง

Sourceยง

impl StyledString

Source

pub fn get_fg(&self) -> Option<Color>

Gets the foreground color

Source

pub fn get_bg(&self) -> Option<Color>

Gets the background color

Source

pub fn get_decoration(&self) -> Option<Vec<Decoration>>

Gets the text decoration

Source

pub fn get_text(&self) -> &str

Gets the text content

Source

pub fn color(self, color: Color) -> Self

Set text color

Source

pub fn bg(self, color: Color) -> Self

Set background color

Examples found in repository?
examples/fluent.rs (line 10)
3fn main() {
4    println!("Direct styling with fluent interface:\n");
5    
6    // Basic color styling
7    println!("{}", "Red text".color(Color::Red));
8    
9    // Background color
10    println!("{}", "Blue text on yellow background".color(Color::Blue).bg(Color::Yellow));
11    
12    // Decorations
13    println!("{}", "Bold and italic text".decoration(Decoration::Bold).decoration(Decoration::Italic));
14    
15    // Padding and border
16    println!("{}", "Text with padding and border"
17        .padding(1)
18        .border(BorderStyle::Solid)
19        .border_color(Color::Green));
20    
21    // Complex chained styling
22    println!("{}", "Complex styling example"
23        .color(Color::Code(48))
24        .bg(Color::IntenseGreen)
25        .decoration(Decoration::Reverse)
26        .decoration(Decoration::DoubleUnderline)
27        .padding_trbl(1, 2, 1, 2)
28        .margin(1)
29        .border(BorderStyle::Double)
30        .border_color(Color::Yellow));
31    
32    // Different border styles
33    println!("{}", "Solid border".border(BorderStyle::Solid).padding(1));
34    println!("{}", "Dashed border".border(BorderStyle::Dashed).padding(1));
35    println!("{}", "Rounded border".border(BorderStyle::Rounded).padding(1));
36    
37    // Multiple decorations
38    let decorated = "Multiple decorations: bold, italic, underline"
39        .decoration(Decoration::Bold)
40        .decoration(Decoration::Italic)
41        .decoration(Decoration::Underline);
42    println!("{}", decorated);
43}
More examples
Hide additional examples
examples/emoji.rs (line 10)
3fn main() {
4    println!("Styling text with emoji using Terminal CSS:\n");
5    
6    // Basic emoji styling
7    println!("{}", "๐Ÿš€ Rocket launch!".color(Color::Blue));
8    
9    // Emoji with background
10    println!("{}", "๐ŸŽ‰ Celebration ๐ŸŽŠ".color(Color::Yellow).bg(Color::Black));
11    
12    // Emoji with decorations
13    println!("{}", "โš ๏ธ Warning!".color(Color::Red).decoration(Decoration::Bold));
14    
15    // Emoji in borders
16    println!("{}", "๐Ÿ” Delicious burger ๐ŸŸ"
17        .padding(1)
18        .border(BorderStyle::Rounded)
19        .border_color(Color::Green));
20    
21    // Emoji as bullet points in a list
22    let items = vec![
23        "๐ŸŽ Apple",
24        "๐ŸŒ Banana",
25        "๐Ÿ‡ Grapes",
26        "๐Ÿ“ Strawberry",
27        "๐Ÿฅญ Mango",
28    ];
29    
30    let list = items.join("\n");
31    println!("{}", list
32        .color(Color::Magenta)
33        .padding(1)
34        .border(BorderStyle::Dashed)
35        .border_color(Color::Cyan));
36    
37    // Emoji status indicators
38    println!("{}", "โœ… Task completed"
39        .color(Color::Green)
40        .decoration(Decoration::Bold));
41    
42    println!("{}", "โŒ Task failed"
43        .color(Color::Red)
44        .decoration(Decoration::Bold));
45    
46    println!("{}", "โณ Task in progress"
47        .color(Color::Yellow)
48        .decoration(Decoration::Italic));
49    
50    // Complex emoji dashboard example
51      println!("\n{}", "๐Ÿ“Š System Dashboard ๐Ÿ“ˆ"
52        .color(Color::Blue)
53        .decoration(Decoration::Bold)
54        .padding(1)
55        .border(BorderStyle::Double)
56        .border_color(Color::IntenseBlue));
57    
58    let dashboard = vec![
59        "๐Ÿ”‹ Battery: 85%",
60        "๐Ÿ’พ Disk: 120GB free",
61        "๐Ÿ–ฅ๏ธ CPU: 12% usage",
62        "๐Ÿง  Memory: 4GB available",
63        "๐ŸŒก๏ธ Temperature: 45ยฐC",
64    ];
65    
66    let dashboard_text = dashboard.join("\n");
67    println!("{}", dashboard_text
68        .color(Color::White)
69        .bg(Color::Black)
70        .padding(1)
71        .border(BorderStyle::Solid)
72        .border_color(Color::Cyan));
73}
Source

pub fn decoration(self, decoration: Decoration) -> Self

Add decoration

Examples found in repository?
examples/fluent.rs (line 13)
3fn main() {
4    println!("Direct styling with fluent interface:\n");
5    
6    // Basic color styling
7    println!("{}", "Red text".color(Color::Red));
8    
9    // Background color
10    println!("{}", "Blue text on yellow background".color(Color::Blue).bg(Color::Yellow));
11    
12    // Decorations
13    println!("{}", "Bold and italic text".decoration(Decoration::Bold).decoration(Decoration::Italic));
14    
15    // Padding and border
16    println!("{}", "Text with padding and border"
17        .padding(1)
18        .border(BorderStyle::Solid)
19        .border_color(Color::Green));
20    
21    // Complex chained styling
22    println!("{}", "Complex styling example"
23        .color(Color::Code(48))
24        .bg(Color::IntenseGreen)
25        .decoration(Decoration::Reverse)
26        .decoration(Decoration::DoubleUnderline)
27        .padding_trbl(1, 2, 1, 2)
28        .margin(1)
29        .border(BorderStyle::Double)
30        .border_color(Color::Yellow));
31    
32    // Different border styles
33    println!("{}", "Solid border".border(BorderStyle::Solid).padding(1));
34    println!("{}", "Dashed border".border(BorderStyle::Dashed).padding(1));
35    println!("{}", "Rounded border".border(BorderStyle::Rounded).padding(1));
36    
37    // Multiple decorations
38    let decorated = "Multiple decorations: bold, italic, underline"
39        .decoration(Decoration::Bold)
40        .decoration(Decoration::Italic)
41        .decoration(Decoration::Underline);
42    println!("{}", decorated);
43}
More examples
Hide additional examples
examples/emoji.rs (line 13)
3fn main() {
4    println!("Styling text with emoji using Terminal CSS:\n");
5    
6    // Basic emoji styling
7    println!("{}", "๐Ÿš€ Rocket launch!".color(Color::Blue));
8    
9    // Emoji with background
10    println!("{}", "๐ŸŽ‰ Celebration ๐ŸŽŠ".color(Color::Yellow).bg(Color::Black));
11    
12    // Emoji with decorations
13    println!("{}", "โš ๏ธ Warning!".color(Color::Red).decoration(Decoration::Bold));
14    
15    // Emoji in borders
16    println!("{}", "๐Ÿ” Delicious burger ๐ŸŸ"
17        .padding(1)
18        .border(BorderStyle::Rounded)
19        .border_color(Color::Green));
20    
21    // Emoji as bullet points in a list
22    let items = vec![
23        "๐ŸŽ Apple",
24        "๐ŸŒ Banana",
25        "๐Ÿ‡ Grapes",
26        "๐Ÿ“ Strawberry",
27        "๐Ÿฅญ Mango",
28    ];
29    
30    let list = items.join("\n");
31    println!("{}", list
32        .color(Color::Magenta)
33        .padding(1)
34        .border(BorderStyle::Dashed)
35        .border_color(Color::Cyan));
36    
37    // Emoji status indicators
38    println!("{}", "โœ… Task completed"
39        .color(Color::Green)
40        .decoration(Decoration::Bold));
41    
42    println!("{}", "โŒ Task failed"
43        .color(Color::Red)
44        .decoration(Decoration::Bold));
45    
46    println!("{}", "โณ Task in progress"
47        .color(Color::Yellow)
48        .decoration(Decoration::Italic));
49    
50    // Complex emoji dashboard example
51      println!("\n{}", "๐Ÿ“Š System Dashboard ๐Ÿ“ˆ"
52        .color(Color::Blue)
53        .decoration(Decoration::Bold)
54        .padding(1)
55        .border(BorderStyle::Double)
56        .border_color(Color::IntenseBlue));
57    
58    let dashboard = vec![
59        "๐Ÿ”‹ Battery: 85%",
60        "๐Ÿ’พ Disk: 120GB free",
61        "๐Ÿ–ฅ๏ธ CPU: 12% usage",
62        "๐Ÿง  Memory: 4GB available",
63        "๐ŸŒก๏ธ Temperature: 45ยฐC",
64    ];
65    
66    let dashboard_text = dashboard.join("\n");
67    println!("{}", dashboard_text
68        .color(Color::White)
69        .bg(Color::Black)
70        .padding(1)
71        .border(BorderStyle::Solid)
72        .border_color(Color::Cyan));
73}
Source

pub fn padding(self, padding: u8) -> Self

Set padding (all sides)

Examples found in repository?
examples/fluent.rs (line 33)
3fn main() {
4    println!("Direct styling with fluent interface:\n");
5    
6    // Basic color styling
7    println!("{}", "Red text".color(Color::Red));
8    
9    // Background color
10    println!("{}", "Blue text on yellow background".color(Color::Blue).bg(Color::Yellow));
11    
12    // Decorations
13    println!("{}", "Bold and italic text".decoration(Decoration::Bold).decoration(Decoration::Italic));
14    
15    // Padding and border
16    println!("{}", "Text with padding and border"
17        .padding(1)
18        .border(BorderStyle::Solid)
19        .border_color(Color::Green));
20    
21    // Complex chained styling
22    println!("{}", "Complex styling example"
23        .color(Color::Code(48))
24        .bg(Color::IntenseGreen)
25        .decoration(Decoration::Reverse)
26        .decoration(Decoration::DoubleUnderline)
27        .padding_trbl(1, 2, 1, 2)
28        .margin(1)
29        .border(BorderStyle::Double)
30        .border_color(Color::Yellow));
31    
32    // Different border styles
33    println!("{}", "Solid border".border(BorderStyle::Solid).padding(1));
34    println!("{}", "Dashed border".border(BorderStyle::Dashed).padding(1));
35    println!("{}", "Rounded border".border(BorderStyle::Rounded).padding(1));
36    
37    // Multiple decorations
38    let decorated = "Multiple decorations: bold, italic, underline"
39        .decoration(Decoration::Bold)
40        .decoration(Decoration::Italic)
41        .decoration(Decoration::Underline);
42    println!("{}", decorated);
43}
More examples
Hide additional examples
examples/emoji.rs (line 33)
3fn main() {
4    println!("Styling text with emoji using Terminal CSS:\n");
5    
6    // Basic emoji styling
7    println!("{}", "๐Ÿš€ Rocket launch!".color(Color::Blue));
8    
9    // Emoji with background
10    println!("{}", "๐ŸŽ‰ Celebration ๐ŸŽŠ".color(Color::Yellow).bg(Color::Black));
11    
12    // Emoji with decorations
13    println!("{}", "โš ๏ธ Warning!".color(Color::Red).decoration(Decoration::Bold));
14    
15    // Emoji in borders
16    println!("{}", "๐Ÿ” Delicious burger ๐ŸŸ"
17        .padding(1)
18        .border(BorderStyle::Rounded)
19        .border_color(Color::Green));
20    
21    // Emoji as bullet points in a list
22    let items = vec![
23        "๐ŸŽ Apple",
24        "๐ŸŒ Banana",
25        "๐Ÿ‡ Grapes",
26        "๐Ÿ“ Strawberry",
27        "๐Ÿฅญ Mango",
28    ];
29    
30    let list = items.join("\n");
31    println!("{}", list
32        .color(Color::Magenta)
33        .padding(1)
34        .border(BorderStyle::Dashed)
35        .border_color(Color::Cyan));
36    
37    // Emoji status indicators
38    println!("{}", "โœ… Task completed"
39        .color(Color::Green)
40        .decoration(Decoration::Bold));
41    
42    println!("{}", "โŒ Task failed"
43        .color(Color::Red)
44        .decoration(Decoration::Bold));
45    
46    println!("{}", "โณ Task in progress"
47        .color(Color::Yellow)
48        .decoration(Decoration::Italic));
49    
50    // Complex emoji dashboard example
51      println!("\n{}", "๐Ÿ“Š System Dashboard ๐Ÿ“ˆ"
52        .color(Color::Blue)
53        .decoration(Decoration::Bold)
54        .padding(1)
55        .border(BorderStyle::Double)
56        .border_color(Color::IntenseBlue));
57    
58    let dashboard = vec![
59        "๐Ÿ”‹ Battery: 85%",
60        "๐Ÿ’พ Disk: 120GB free",
61        "๐Ÿ–ฅ๏ธ CPU: 12% usage",
62        "๐Ÿง  Memory: 4GB available",
63        "๐ŸŒก๏ธ Temperature: 45ยฐC",
64    ];
65    
66    let dashboard_text = dashboard.join("\n");
67    println!("{}", dashboard_text
68        .color(Color::White)
69        .bg(Color::Black)
70        .padding(1)
71        .border(BorderStyle::Solid)
72        .border_color(Color::Cyan));
73}
Source

pub fn padding_trbl(self, top: u8, right: u8, bottom: u8, left: u8) -> Self

Set padding for specific sides

Examples found in repository?
examples/fluent.rs (line 27)
3fn main() {
4    println!("Direct styling with fluent interface:\n");
5    
6    // Basic color styling
7    println!("{}", "Red text".color(Color::Red));
8    
9    // Background color
10    println!("{}", "Blue text on yellow background".color(Color::Blue).bg(Color::Yellow));
11    
12    // Decorations
13    println!("{}", "Bold and italic text".decoration(Decoration::Bold).decoration(Decoration::Italic));
14    
15    // Padding and border
16    println!("{}", "Text with padding and border"
17        .padding(1)
18        .border(BorderStyle::Solid)
19        .border_color(Color::Green));
20    
21    // Complex chained styling
22    println!("{}", "Complex styling example"
23        .color(Color::Code(48))
24        .bg(Color::IntenseGreen)
25        .decoration(Decoration::Reverse)
26        .decoration(Decoration::DoubleUnderline)
27        .padding_trbl(1, 2, 1, 2)
28        .margin(1)
29        .border(BorderStyle::Double)
30        .border_color(Color::Yellow));
31    
32    // Different border styles
33    println!("{}", "Solid border".border(BorderStyle::Solid).padding(1));
34    println!("{}", "Dashed border".border(BorderStyle::Dashed).padding(1));
35    println!("{}", "Rounded border".border(BorderStyle::Rounded).padding(1));
36    
37    // Multiple decorations
38    let decorated = "Multiple decorations: bold, italic, underline"
39        .decoration(Decoration::Bold)
40        .decoration(Decoration::Italic)
41        .decoration(Decoration::Underline);
42    println!("{}", decorated);
43}
Source

pub fn margin(self, margin: u8) -> Self

Set margin (all sides)

Examples found in repository?
examples/fluent.rs (line 28)
3fn main() {
4    println!("Direct styling with fluent interface:\n");
5    
6    // Basic color styling
7    println!("{}", "Red text".color(Color::Red));
8    
9    // Background color
10    println!("{}", "Blue text on yellow background".color(Color::Blue).bg(Color::Yellow));
11    
12    // Decorations
13    println!("{}", "Bold and italic text".decoration(Decoration::Bold).decoration(Decoration::Italic));
14    
15    // Padding and border
16    println!("{}", "Text with padding and border"
17        .padding(1)
18        .border(BorderStyle::Solid)
19        .border_color(Color::Green));
20    
21    // Complex chained styling
22    println!("{}", "Complex styling example"
23        .color(Color::Code(48))
24        .bg(Color::IntenseGreen)
25        .decoration(Decoration::Reverse)
26        .decoration(Decoration::DoubleUnderline)
27        .padding_trbl(1, 2, 1, 2)
28        .margin(1)
29        .border(BorderStyle::Double)
30        .border_color(Color::Yellow));
31    
32    // Different border styles
33    println!("{}", "Solid border".border(BorderStyle::Solid).padding(1));
34    println!("{}", "Dashed border".border(BorderStyle::Dashed).padding(1));
35    println!("{}", "Rounded border".border(BorderStyle::Rounded).padding(1));
36    
37    // Multiple decorations
38    let decorated = "Multiple decorations: bold, italic, underline"
39        .decoration(Decoration::Bold)
40        .decoration(Decoration::Italic)
41        .decoration(Decoration::Underline);
42    println!("{}", decorated);
43}
Source

pub fn border(self, style: BorderStyle) -> Self

Set border style

Examples found in repository?
examples/fluent.rs (line 18)
3fn main() {
4    println!("Direct styling with fluent interface:\n");
5    
6    // Basic color styling
7    println!("{}", "Red text".color(Color::Red));
8    
9    // Background color
10    println!("{}", "Blue text on yellow background".color(Color::Blue).bg(Color::Yellow));
11    
12    // Decorations
13    println!("{}", "Bold and italic text".decoration(Decoration::Bold).decoration(Decoration::Italic));
14    
15    // Padding and border
16    println!("{}", "Text with padding and border"
17        .padding(1)
18        .border(BorderStyle::Solid)
19        .border_color(Color::Green));
20    
21    // Complex chained styling
22    println!("{}", "Complex styling example"
23        .color(Color::Code(48))
24        .bg(Color::IntenseGreen)
25        .decoration(Decoration::Reverse)
26        .decoration(Decoration::DoubleUnderline)
27        .padding_trbl(1, 2, 1, 2)
28        .margin(1)
29        .border(BorderStyle::Double)
30        .border_color(Color::Yellow));
31    
32    // Different border styles
33    println!("{}", "Solid border".border(BorderStyle::Solid).padding(1));
34    println!("{}", "Dashed border".border(BorderStyle::Dashed).padding(1));
35    println!("{}", "Rounded border".border(BorderStyle::Rounded).padding(1));
36    
37    // Multiple decorations
38    let decorated = "Multiple decorations: bold, italic, underline"
39        .decoration(Decoration::Bold)
40        .decoration(Decoration::Italic)
41        .decoration(Decoration::Underline);
42    println!("{}", decorated);
43}
More examples
Hide additional examples
examples/emoji.rs (line 18)
3fn main() {
4    println!("Styling text with emoji using Terminal CSS:\n");
5    
6    // Basic emoji styling
7    println!("{}", "๐Ÿš€ Rocket launch!".color(Color::Blue));
8    
9    // Emoji with background
10    println!("{}", "๐ŸŽ‰ Celebration ๐ŸŽŠ".color(Color::Yellow).bg(Color::Black));
11    
12    // Emoji with decorations
13    println!("{}", "โš ๏ธ Warning!".color(Color::Red).decoration(Decoration::Bold));
14    
15    // Emoji in borders
16    println!("{}", "๐Ÿ” Delicious burger ๐ŸŸ"
17        .padding(1)
18        .border(BorderStyle::Rounded)
19        .border_color(Color::Green));
20    
21    // Emoji as bullet points in a list
22    let items = vec![
23        "๐ŸŽ Apple",
24        "๐ŸŒ Banana",
25        "๐Ÿ‡ Grapes",
26        "๐Ÿ“ Strawberry",
27        "๐Ÿฅญ Mango",
28    ];
29    
30    let list = items.join("\n");
31    println!("{}", list
32        .color(Color::Magenta)
33        .padding(1)
34        .border(BorderStyle::Dashed)
35        .border_color(Color::Cyan));
36    
37    // Emoji status indicators
38    println!("{}", "โœ… Task completed"
39        .color(Color::Green)
40        .decoration(Decoration::Bold));
41    
42    println!("{}", "โŒ Task failed"
43        .color(Color::Red)
44        .decoration(Decoration::Bold));
45    
46    println!("{}", "โณ Task in progress"
47        .color(Color::Yellow)
48        .decoration(Decoration::Italic));
49    
50    // Complex emoji dashboard example
51      println!("\n{}", "๐Ÿ“Š System Dashboard ๐Ÿ“ˆ"
52        .color(Color::Blue)
53        .decoration(Decoration::Bold)
54        .padding(1)
55        .border(BorderStyle::Double)
56        .border_color(Color::IntenseBlue));
57    
58    let dashboard = vec![
59        "๐Ÿ”‹ Battery: 85%",
60        "๐Ÿ’พ Disk: 120GB free",
61        "๐Ÿ–ฅ๏ธ CPU: 12% usage",
62        "๐Ÿง  Memory: 4GB available",
63        "๐ŸŒก๏ธ Temperature: 45ยฐC",
64    ];
65    
66    let dashboard_text = dashboard.join("\n");
67    println!("{}", dashboard_text
68        .color(Color::White)
69        .bg(Color::Black)
70        .padding(1)
71        .border(BorderStyle::Solid)
72        .border_color(Color::Cyan));
73}
Source

pub fn border_color(self, color: Color) -> Self

Set border color

Examples found in repository?
examples/fluent.rs (line 19)
3fn main() {
4    println!("Direct styling with fluent interface:\n");
5    
6    // Basic color styling
7    println!("{}", "Red text".color(Color::Red));
8    
9    // Background color
10    println!("{}", "Blue text on yellow background".color(Color::Blue).bg(Color::Yellow));
11    
12    // Decorations
13    println!("{}", "Bold and italic text".decoration(Decoration::Bold).decoration(Decoration::Italic));
14    
15    // Padding and border
16    println!("{}", "Text with padding and border"
17        .padding(1)
18        .border(BorderStyle::Solid)
19        .border_color(Color::Green));
20    
21    // Complex chained styling
22    println!("{}", "Complex styling example"
23        .color(Color::Code(48))
24        .bg(Color::IntenseGreen)
25        .decoration(Decoration::Reverse)
26        .decoration(Decoration::DoubleUnderline)
27        .padding_trbl(1, 2, 1, 2)
28        .margin(1)
29        .border(BorderStyle::Double)
30        .border_color(Color::Yellow));
31    
32    // Different border styles
33    println!("{}", "Solid border".border(BorderStyle::Solid).padding(1));
34    println!("{}", "Dashed border".border(BorderStyle::Dashed).padding(1));
35    println!("{}", "Rounded border".border(BorderStyle::Rounded).padding(1));
36    
37    // Multiple decorations
38    let decorated = "Multiple decorations: bold, italic, underline"
39        .decoration(Decoration::Bold)
40        .decoration(Decoration::Italic)
41        .decoration(Decoration::Underline);
42    println!("{}", decorated);
43}
More examples
Hide additional examples
examples/emoji.rs (line 19)
3fn main() {
4    println!("Styling text with emoji using Terminal CSS:\n");
5    
6    // Basic emoji styling
7    println!("{}", "๐Ÿš€ Rocket launch!".color(Color::Blue));
8    
9    // Emoji with background
10    println!("{}", "๐ŸŽ‰ Celebration ๐ŸŽŠ".color(Color::Yellow).bg(Color::Black));
11    
12    // Emoji with decorations
13    println!("{}", "โš ๏ธ Warning!".color(Color::Red).decoration(Decoration::Bold));
14    
15    // Emoji in borders
16    println!("{}", "๐Ÿ” Delicious burger ๐ŸŸ"
17        .padding(1)
18        .border(BorderStyle::Rounded)
19        .border_color(Color::Green));
20    
21    // Emoji as bullet points in a list
22    let items = vec![
23        "๐ŸŽ Apple",
24        "๐ŸŒ Banana",
25        "๐Ÿ‡ Grapes",
26        "๐Ÿ“ Strawberry",
27        "๐Ÿฅญ Mango",
28    ];
29    
30    let list = items.join("\n");
31    println!("{}", list
32        .color(Color::Magenta)
33        .padding(1)
34        .border(BorderStyle::Dashed)
35        .border_color(Color::Cyan));
36    
37    // Emoji status indicators
38    println!("{}", "โœ… Task completed"
39        .color(Color::Green)
40        .decoration(Decoration::Bold));
41    
42    println!("{}", "โŒ Task failed"
43        .color(Color::Red)
44        .decoration(Decoration::Bold));
45    
46    println!("{}", "โณ Task in progress"
47        .color(Color::Yellow)
48        .decoration(Decoration::Italic));
49    
50    // Complex emoji dashboard example
51      println!("\n{}", "๐Ÿ“Š System Dashboard ๐Ÿ“ˆ"
52        .color(Color::Blue)
53        .decoration(Decoration::Bold)
54        .padding(1)
55        .border(BorderStyle::Double)
56        .border_color(Color::IntenseBlue));
57    
58    let dashboard = vec![
59        "๐Ÿ”‹ Battery: 85%",
60        "๐Ÿ’พ Disk: 120GB free",
61        "๐Ÿ–ฅ๏ธ CPU: 12% usage",
62        "๐Ÿง  Memory: 4GB available",
63        "๐ŸŒก๏ธ Temperature: 45ยฐC",
64    ];
65    
66    let dashboard_text = dashboard.join("\n");
67    println!("{}", dashboard_text
68        .color(Color::White)
69        .bg(Color::Black)
70        .padding(1)
71        .border(BorderStyle::Solid)
72        .border_color(Color::Cyan));
73}

Trait Implementationsยง

Sourceยง

impl Clone for StyledString

Sourceยง

fn clone(&self) -> StyledString

Returns a duplicate of the value. Read more
1.0.0 ยท Sourceยง

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Sourceยง

impl Display for StyledString

Sourceยง

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementationsยง

Blanket Implementationsยง

Sourceยง

impl<T> Any for T
where T: 'static + ?Sized,

Sourceยง

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Sourceยง

impl<T> Borrow<T> for T
where T: ?Sized,

Sourceยง

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Sourceยง

impl<T> BorrowMut<T> for T
where T: ?Sized,

Sourceยง

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Sourceยง

impl<T> CloneToUninit for T
where T: Clone,

Sourceยง

unsafe fn clone_to_uninit(&self, dest: *mut u8)

๐Ÿ”ฌThis is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Sourceยง

impl<T> From<T> for T

Sourceยง

fn from(t: T) -> T

Returns the argument unchanged.

Sourceยง

impl<T, U> Into<U> for T
where U: From<T>,

Sourceยง

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Sourceยง

impl<T> ToOwned for T
where T: Clone,

Sourceยง

type Owned = T

The resulting type after obtaining ownership.
Sourceยง

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Sourceยง

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Sourceยง

impl<T> ToString for T
where T: Display + ?Sized,

Sourceยง

fn to_string(&self) -> String

Converts the given value to a String. Read more
Sourceยง

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Sourceยง

type Error = Infallible

The type returned in the event of a conversion error.
Sourceยง

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Sourceยง

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Sourceยง

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Sourceยง

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.