Skip to content

Commit

Permalink
Specifically implement ArrowShape conversion for array sizes
Browse files Browse the repository at this point in the history
  • Loading branch information
clubby789 committed May 17, 2022
1 parent 64419c8 commit ff873e8
Showing 1 changed file with 10 additions and 3 deletions.
13 changes: 10 additions & 3 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -669,11 +669,18 @@ impl Arrow {
}


impl<const N: usize> From<[ArrowShape; N]> for Arrow {
fn from(shape: [ArrowShape; N]) -> Arrow {
Arrow {arrows: shape.to_vec() }
macro_rules! arrowshape_to_arrow {
($n:expr) => {
impl From<[ArrowShape; $n]> for Arrow {
fn from(shape: [ArrowShape; $n]) -> Arrow {
Arrow {arrows: shape.to_vec() }
}
}
}
}
arrowshape_to_arrow!(2);
arrowshape_to_arrow!(3);
arrowshape_to_arrow!(4);

/// Arrow modifier that determines if the shape is empty or filled.
#[derive(Clone, Copy, Hash, PartialEq, Eq)]
Expand Down

0 comments on commit ff873e8

Please sign in to comment.