mirror of
https://github.com/KaiserY/trpl-zh-cn
synced 2025-05-04 20:48:03 +08:00
18 lines
429 B
Rust
Executable File
18 lines
429 B
Rust
Executable File
// ANCHOR: here
|
|
use std::fmt;
|
|
|
|
trait OutlinePrint: fmt::Display {
|
|
fn outline_print(&self) {
|
|
let output = self.to_string();
|
|
let len = output.len();
|
|
println!("{}", "*".repeat(len + 4));
|
|
println!("*{}*", " ".repeat(len + 2));
|
|
println!("* {} *", output);
|
|
println!("*{}*", " ".repeat(len + 2));
|
|
println!("{}", "*".repeat(len + 4));
|
|
}
|
|
}
|
|
// ANCHOR_END: here
|
|
|
|
fn main() {}
|