a1/row/
into.rs

1use crate::{RangeOrCell, Row, A1};
2
3#[allow(clippy::from_over_into)]
4impl Into<RangeOrCell> for Row {
5    fn into(self) -> RangeOrCell {
6        RangeOrCell::RowRange {
7            from: self,
8            to: self,
9        }
10    }
11}
12
13#[allow(clippy::from_over_into)]
14impl Into<A1> for Row {
15    fn into(self) -> A1 {
16        A1 {
17            sheet_name: None,
18            reference: self.into(),
19        }
20    }
21}
22
23#[cfg(test)]
24mod tests {
25    use crate::*;
26
27    #[test]
28    fn into_row() {
29        assert_eq!(
30            RangeOrCell::RowRange {
31                from: Row::new(0),
32                to: Row::new(0),
33            },
34            Row::new(0).into()
35        );
36    }
37
38    #[test]
39    fn into_a1() {
40        assert_eq!(
41            A1 {
42                sheet_name: None,
43                reference: RangeOrCell::RowRange {
44                    from: Row::new(0),
45                    to: Row::new(0),
46                },
47            },
48            Row::new(0).into()
49        );
50    }
51}