pub fn render_partial(&self, offset: usize) -> Option<Vec<String>> {
        // Return nothing if there is no data
        if self.data.len().saturating_sub(offset) == 0 {
            return Some(vec![]);
        }
        // Create copy of data
        let mut data = self.data.clone();
        // Reform into columns
        let mut columns = vec![];
        for column in 0..data[0].len() {
            let mut this = vec![];
            for row in &data {
                // Returns None if table is in an invalid format
                this.push(row.get(column)?)
            }
            columns.push(this);
        }
        // For each column in this table, work out the maximum space required
        let mut limits = vec![];
        for column in &columns {
            limits.push(find_longest(column));
        }
        // Strip columns until it fits
        let mut pri = self.priorities.clone();
        let mut pad_places = if self.surround {
            columns.len() + 1
        } else {
            columns.len().saturating_sub(1)
        };
        let mut column_count = columns.len().saturating_sub(1);
        while limits.iter().sum::<usize>() + pad_places > self.space {
            // Work out which column to remove
            let rm = pri.iter().min().unwrap_or(&0);
            let rm = pri.iter().position(|x| x == rm).unwrap_or(column_count);
            // Remove from data
            for row in data.iter_mut().skip(offset) {
                row.remove(rm);
            }
            // Remove from limits
            limits.remove(rm);
            // Remove from priority
            if !pri.is_empty() {
                pri.remove(rm);
            }
            // Decrement counters
            pad_places = pad_places.saturating_sub(1);
            column_count = column_count.saturating_sub(1);
        }
        // Correctly align each item within said columns and format them
        let mut result = vec![];
        for row in data.iter().skip(offset) {
            let mut this = vec![];
            for (column, limit) in row.iter().zip(&limits) {
                // Align cell
                let cell = match self.align {
                    Align::Left => align::left(column, *limit),
                    Align::Right => align::right(column, *limit),
                    Align::Center => align::center(column, *limit),
                };
                this.push(cell.unwrap());
            }
            // Get parts as a vector of &str (for use in align functions)
            let parts = this.iter().map(|x| x.as_str()).collect::<Vec<_>>();
            // Do alignment
            result.push(if self.surround {
                align::around(parts.as_slice(), self.space)
            } else {
                align::between(parts.as_slice(), self.space)
            }?);
        }
        Some(result)
    }
/// Only renders rows after `offset` row. This is particularly useful if you have a table
/// that you wish to fit into a terminal with a height shorter than the table.
///
/// This will return `None` if there is not enough space to fit the table, or if the offset is
/// out of bounds
Only renders rows after `offset` row. This is particularly useful if you have a table
that you wish to fit into a terminal with a height shorter than the table.

This will return `None` if there is not enough space to fit the table, or if the offset is
out of bounds
Only renders rows after ` offset ` row . This is particularly useful if you have a table that you wish to fit into a terminal with a height shorter than the table . This will return ` None ` if there is not enough space to fit the table or if the offset is out of bounds
pub fn render_partial(&self, offset: usize) -> Option<Vec<String>> {
        // Return nothing if there is no data
        if self.data.len().saturating_sub(offset) == 0 {
            return Some(vec![]);
        }
        // Create copy of data
        let mut data = self.data.clone();
        // Reform into columns
        let mut columns = vec![];
        for column in 0..data[0].len() {
            let mut this = vec![];
            for row in &data {
                // Returns None if table is in an invalid format
                this.push(row.get(column)?)
            }
            columns.push(this);
        }
        // For each column in this table, work out the maximum space required
        let mut limits = vec![];
        for column in &columns {
            limits.push(find_longest(column));
        }
        // Strip columns until it fits
        let mut pri = self.priorities.clone();
        let mut pad_places = if self.surround {
            columns.len() + 1
        } else {
            columns.len().saturating_sub(1)
        };
        let mut column_count = columns.len().saturating_sub(1);
        while limits.iter().sum::<usize>() + pad_places > self.space {
            // Work out which column to remove
            let rm = pri.iter().min().unwrap_or(&0);
            let rm = pri.iter().position(|x| x == rm).unwrap_or(column_count);
            // Remove from data
            for row in data.iter_mut().skip(offset) {
                row.remove(rm);
            }
            // Remove from limits
            limits.remove(rm);
            // Remove from priority
            if !pri.is_empty() {
                pri.remove(rm);
            }
            // Decrement counters
            pad_places = pad_places.saturating_sub(1);
            column_count = column_count.saturating_sub(1);
        }
        // Correctly align each item within said columns and format them
        let mut result = vec![];
        for row in data.iter().skip(offset) {
            let mut this = vec![];
            for (column, limit) in row.iter().zip(&limits) {
                // Align cell
                let cell = match self.align {
                    Align::Left => align::left(column, *limit),
                    Align::Right => align::right(column, *limit),
                    Align::Center => align::center(column, *limit),
                };
                this.push(cell.unwrap());
            }
            // Get parts as a vector of &str (for use in align functions)
            let parts = this.iter().map(|x| x.as_str()).collect::<Vec<_>>();
            // Do alignment
            result.push(if self.surround {
                align::around(parts.as_slice(), self.space)
            } else {
                align::between(parts.as_slice(), self.space)
            }?);
        }
        Some(result)
    }
pub fn render_partial ( & self , offset : usize ) -> Option < Vec < String > > { // Return nothing if there is no data if self . data . len ( ) . saturating_sub ( offset ) == 0 { return Some ( vec ! [ ] ) ; } // Create copy of data let mut data = self . data . clone ( ) ; // Reform into columns let mut columns = vec ! [ ] ; for column in 0 .. data [ 0 ] . len ( ) { let mut this = vec ! [ ] ; for row in & data { // Returns None if table is in an invalid format this . push ( row . get ( column ) ? ) } columns . push ( this ) ; } // For each column in this table, work out the maximum space required let mut limits = vec ! [ ] ; for column in & columns { limits . push ( find_longest ( column ) ) ; } // Strip columns until it fits let mut pri = self . priorities . clone ( ) ; let mut pad_places = if self . surround { columns . len ( ) + 1 } else { columns . len ( ) . saturating_sub ( 1 ) } ; let mut column_count = columns . len ( ) . saturating_sub ( 1 ) ; while limits . iter ( ) . sum :: < usize > ( ) + pad_places > self . space { // Work out which column to remove let rm = pri . iter ( ) . min ( ) . unwrap_or ( & 0 ) ; let rm = pri . iter ( ) . position ( | x | x == rm ) . unwrap_or ( column_count ) ; // Remove from data for row in data . iter_mut ( ) . skip ( offset ) { row . remove ( rm ) ; } // Remove from limits limits . remove ( rm ) ; // Remove from priority if ! pri . is_empty ( ) { pri . remove ( rm ) ; } // Decrement counters pad_places = pad_places . saturating_sub ( 1 ) ; column_count = column_count . saturating_sub ( 1 ) ; } // Correctly align each item within said columns and format them let mut result = vec ! [ ] ; for row in data . iter ( ) . skip ( offset ) { let mut this = vec ! [ ] ; for ( column , limit ) in row . iter ( ) . zip ( & limits ) { // Align cell let cell = match self . align { Align :: Left => align :: left ( column , * limit ) , Align :: Right => align :: right ( column , * limit ) , Align :: Center => align :: center ( column , * limit ) , } ; this . push ( cell . unwrap ( ) ) ; } // Get parts as a vector of &str (for use in align functions) let parts = this . iter ( ) . map ( | x | x . as_str ( ) ) . collect :: < Vec < _ > > ( ) ; // Do alignment result . push ( if self . surround { align :: around ( parts . as_slice ( ) , self . space ) } else { align :: between ( parts . as_slice ( ) , self . space ) } ? ) ; } Some ( result ) }
Only renders rows after `offset` row.
Only renders rows after ` offset ` row .
&self
offset
usize