fn truncate_lines()

in src/content/lines.rs [131:184]


    fn truncate_lines(&mut self, max_width: usize);

    /// Returns the max column width of any line
    fn max_line_length(&self) -> usize;

    /// Given a set of lines, inserts the specified amount of padding to the longest line.
    /// However, the entire block of lines will remain a rectangle afterwards.
    /// This means that shorter lines will receive extra paddding such that it has the same length as the longest line
    fn pad_lines_right(&mut self, amount: usize);

    /// Prepends a fixed `amount` of padding to each row.
    /// Unlike `pad_lines_right`, this method does not add extra padding to shorter lines.
    /// The right end of the padding remains ragged.
    fn pad_lines_left(&mut self, amount: usize);

    /// Adds padding to each line dependent on its length so that each line is the same length.
    /// The line is left justified always.  This is because right or center aligning lines inherently justifies them.
    /// Therefore, there is no explicit method for justifying text any other way.
    fn justify(&mut self);

    /// Given a set of lines, set them all to the exact width
    fn set_lines_to_exact_width(&mut self, exact_width: usize);

    /// Extends the Lines list by the given length, adding empty lines at the bottom
    fn pad_lines_bottom(&mut self, num_lines_to_add: usize);

    /// Same functionality as `pad_lines_bottom` but on the top.
    fn pad_lines_top(&mut self, num_lines_to_add: usize);

    /// Truncates the line list to the given length, removing entries at the end.
    fn truncate_lines_bottom(&mut self, desired_length: usize);

    /// Sets the line list to the given length, padding or truncating from the bottom.
    fn set_lines_to_exact_length(&mut self, desired_width: usize);

    /// Truncates columns and rows that do not fit within a bounding box
    fn shrink_lines_to_dimensions(&mut self, dimensions: Dimensions);

    /// Formats and renders all lines to `stdout`.
    /// Notably, this *queues* the lines for rendering.  You must flush the buffer.
    /// If a limit is specified, no more than that amount will be drained.
    /// The limit is on the number of *lines*, **NOT** the number of *bytes*.
    /// Care should be taken with calling a limit of 0 - this will cause no lines to render and the buffer to never be drained.
    fn render(&mut self, writer: &mut Vec<u8>, limit: Option<usize>) -> anyhow::Result<()>;

    /// Returns the maximum line width and the number of lines.
    /// This corresponds to how much space a justified version of the output would take.
    fn dimensions(&self) -> anyhow::Result<Dimensions>;

    /// Sets the lines to the exact dimensions specified below, truncating or padding as necessary.
    fn set_lines_to_exact_dimensions(&mut self, desired_dimensions: Dimensions);
}

impl LinesExt for Vec<Line> {