Skip to content

Commit dab0c87

Browse files
committed
more fns, remove trait bound in concrete impl
1 parent 4b63376 commit dab0c87

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

src/traits.rs

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,6 +136,14 @@ impl private::NewTypeMarker for crate::PopulationId {}
136136
#[cfg_attr(doc_cfg, doc(cfg(feature = "provenance")))]
137137
impl private::NewTypeMarker for crate::ProvenanceId {}
138138

139+
/// Interface of a non-ragged table column.
140+
///
141+
/// Unlike slice views of table columns, this API
142+
/// allows indexed via row id types and [`crate::SizeType`].
143+
///
144+
/// # Notes
145+
///
146+
/// * This trait is sealed.
139147
pub trait TableColumn<I, T>:
140148
std::ops::Index<I, Output = T>
141149
+ std::ops::Index<usize, Output = T>
@@ -150,6 +158,14 @@ pub trait TableColumn<I, T>:
150158
where
151159
'a: 'b,
152160
T: 'b;
161+
162+
fn len(&self) -> usize {
163+
self.as_slice().len()
164+
}
165+
166+
fn is_empty(&self) -> bool {
167+
self.as_slice().is_empty()
168+
}
153169
}
154170

155171
impl<T> private::TableColumnMarker for crate::table_column::OpaqueTableColumn<'_, T> {}
@@ -167,7 +183,6 @@ where
167183
impl<I, T> TableColumn<I, T> for crate::table_column::OpaqueTableColumn<'_, T>
168184
where
169185
I: private::NewTypeMarker,
170-
T: Copy,
171186
{
172187
fn as_slice(&self) -> &[T] {
173188
self.0

0 commit comments

Comments
 (0)