Skip to content

Commit 446bf27

Browse files
committed
another option, seems bad
1 parent 8ec71f2 commit 446bf27

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

src/table_column.rs

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,23 @@ impl<T> MutableTableColumn<'_, T> {
3131
}
3232
}
3333

34+
pub trait NTColumn<T> {
35+
fn as_slice(&self) -> &[T];
36+
}
37+
38+
impl<T> NTColumn<T> for TableColumn<'_, T> {
39+
fn as_slice(&self) -> &[T] {
40+
self.as_slice()
41+
}
42+
}
43+
44+
impl<C> std::ops::Index<usize> for dyn NTColumn<C> {
45+
type Output = C;
46+
fn index(&self, index: usize) -> &Self::Output {
47+
&self.as_slice()[index]
48+
}
49+
}
50+
3451
macro_rules! make_table_column {
3552
($name: ident, $index: ident) => {
3653
/// Immutable view of a column

0 commit comments

Comments
 (0)