File tree Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Expand file tree Collapse file tree 2 files changed +4
-4
lines changed Original file line number Diff line number Diff line change @@ -138,14 +138,14 @@ impl TableCollection {
138
138
///
139
139
/// This function allocates a `CString` to pass the file name to the C API.
140
140
/// A panic will occur if the system runs out of memory.
141
- pub fn new_from_file ( filename : & str ) -> Result < Self , TskitError > {
141
+ pub fn new_from_file ( filename : impl AsRef < str > ) -> Result < Self , TskitError > {
142
142
// Arbitrary sequence_length.
143
143
let mut tables = match TableCollection :: new ( 1.0 ) {
144
144
Ok ( t) => ( t) ,
145
145
Err ( e) => return Err ( e) ,
146
146
} ;
147
147
148
- let c_str = std:: ffi:: CString :: new ( filename) . unwrap ( ) ;
148
+ let c_str = std:: ffi:: CString :: new ( filename. as_ref ( ) ) . unwrap ( ) ;
149
149
let rv = unsafe {
150
150
ll_bindings:: tsk_table_collection_load (
151
151
tables. as_mut_ptr ( ) ,
Original file line number Diff line number Diff line change @@ -1042,8 +1042,8 @@ impl TreeSequence {
1042
1042
}
1043
1043
1044
1044
/// Load from a file.
1045
- pub fn load ( filename : & str ) -> Result < Self , TskitError > {
1046
- let tables = TableCollection :: new_from_file ( filename) ?;
1045
+ pub fn load ( filename : impl AsRef < str > ) -> Result < Self , TskitError > {
1046
+ let tables = TableCollection :: new_from_file ( filename. as_ref ( ) ) ?;
1047
1047
1048
1048
Self :: new ( tables, TreeSequenceFlags :: default ( ) )
1049
1049
}
You can’t perform that action at this time.
0 commit comments