Skip to content

Commit 07bf790

Browse files
committed
tests
1 parent 985997a commit 07bf790

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/table_collection.rs

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -134,6 +134,32 @@ impl TableCollection {
134134
/// # std::fs::remove_file("trees.file").unwrap();
135135
/// ```
136136
///
137+
/// The function is generic over references to `str`:
138+
///
139+
/// ```
140+
/// # let empty_tables = tskit::TableCollection::new(100.).unwrap();
141+
/// # empty_tables.dump("trees.file", tskit::TableOutputOptions::default()).unwrap();
142+
/// let filename = String::from("trees.file");
143+
/// let tables = tskit::TableCollection::new_from_file(filename).unwrap();
144+
/// # std::fs::remove_file("trees.file").unwrap();
145+
/// ```
146+
///
147+
/// ```
148+
/// # let empty_tables = tskit::TableCollection::new(100.).unwrap();
149+
/// # empty_tables.dump("trees.file", tskit::TableOutputOptions::default()).unwrap();
150+
/// let filename = String::from("trees.file");
151+
/// let tables = tskit::TableCollection::new_from_file(&filename).unwrap();
152+
/// # std::fs::remove_file("trees.file").unwrap();
153+
/// ```
154+
///
155+
/// ```
156+
/// # let empty_tables = tskit::TableCollection::new(100.).unwrap();
157+
/// # empty_tables.dump("trees.file", tskit::TableOutputOptions::default()).unwrap();
158+
/// let filename = Box::new(String::from("trees.file"));
159+
/// let tables = tskit::TableCollection::new_from_file(&*filename.as_ref()).unwrap();
160+
/// # std::fs::remove_file("trees.file").unwrap();
161+
/// ```
162+
///
137163
/// # Panics
138164
///
139165
/// This function allocates a `CString` to pass the file name to the C API.

0 commit comments

Comments
 (0)