Skip to content

Commit 1057e41

Browse files
committed
do we need this
1 parent 148465c commit 1057e41

File tree

2 files changed

+19
-0
lines changed

2 files changed

+19
-0
lines changed

src/traits.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -209,6 +209,7 @@ where
209209
}
210210

211211
fn edges(&self) -> &crate::EdgeTable {
212+
todo!("can only trigger with with Box<&thing that impl TableAccess>");
212213
T::edges(self)
213214
}
214215
fn sites(&self) -> &crate::SiteTable {

tests/test_table_traits.rs

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,10 @@ impl IteratorOutput {
101101
}
102102
}
103103

104+
struct TablesHolder<'tables> {
105+
tables: &'tables tskit::TableCollection,
106+
}
107+
104108
fn validate_output_from_tables(tables: tskit::TableCollection) {
105109
let tables_output = IteratorOutput::new_from_tables(&tables);
106110
let access_output = IteratorOutput::new_from_table_access(&tables);
@@ -149,6 +153,20 @@ fn test_traits_with_table_collection() {
149153
validate_output_from_tables(tables)
150154
}
151155

156+
#[test]
157+
fn test_traits_with_table_collection_holder() {
158+
let tables = make_tables();
159+
let tref = &tables;
160+
let tables_output = IteratorOutput::new_from_tables(tref);
161+
let access_output = IteratorOutput::new_from_table_access(tref);
162+
assert_eq!(tables_output, access_output);
163+
let iteration_output = IteratorOutput::new_from_table_iteration(tref);
164+
assert_eq!(tables_output, iteration_output);
165+
let boxed = Box::new(tref);
166+
let dynamic_output = IteratorOutput::new_from_dyn(&boxed);
167+
assert_eq!(tables_output, dynamic_output);
168+
}
169+
152170
#[test]
153171
fn test_traits_with_tree_sequence() {
154172
let mut tables = make_tables();

0 commit comments

Comments
 (0)