Struct calamine::Range [] [src]

pub struct Range { /* fields omitted */ }

A struct which represents a squared selection of cells

Methods

impl Range
[src]

Creates a new range

Get top left cell position (row, column)

Get column width

Get column width

Get size

Is range empty

Set inner value

Panics if indexes are out of range bounds

Examples

use calamine::{Range, DataType};

let mut range = Range::new((0, 0), (5, 2));
assert_eq!(range.get_value(2, 1), &DataType::Empty);
range.set_value((2, 1), DataType::Float(1.0)).expect("Could not set value");
assert_eq!(range.get_value(2, 1), &DataType::Float(1.0));

Get cell value

Panics if indexes are out of range bounds

Get an iterator over inner rows

Examples

use calamine::Range;

let range = Range::new((0, 0), (5, 2));
// with rows item row: &[DataType]
assert_eq!(range.rows().flat_map(|row| row).count(), 18);

Trait Implementations

impl Debug for Range
[src]

Formats the value using the given formatter.

impl Default for Range
[src]

Returns the "default value" for a type. Read more

impl Clone for Range
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more