Function create_text_border

Source
pub fn create_text_border(
    message: &str,
    options: Option<TextBorderOptions>,
) -> String
Expand description

Creates a string containing the input message, surrounded by a border and margin as specified by the provided TextBorderOptions.

§Arguments

  • message - The message (&str) to be surrounded by a border.
  • options - An optional TextBorderOptions instance specifying the border and margin configurations. If None, default options are used.

§Returns

  • A String containing the input message surrounded by the specified border and margin.

§Examples

let message = "Hello, World!";

let options = TextBorderOptions {
    border_char: '#',
    border_thickness: (2, 2, 2, 2),
    margin_thickness: (1, 1, 1, 1),
    prevent_trim: true,
};

let bordered_text = create_text_border(message, Some(options));
println!("{}", bordered_text);