File tree Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Expand file tree Collapse file tree 1 file changed +10
-3
lines changed Original file line number Diff line number Diff line change @@ -981,7 +981,7 @@ impl TreeSequence {
981981 /// ```
982982 /// let mut tables = tskit::TableCollection::new(1000.).unwrap();
983983 /// tables.build_index();
984- /// let tree_sequence = tskit::TreeSequence::new (tables, tskit::TreeSequenceFlags::default() ).unwrap();
984+ /// let tree_sequence = tskit::TreeSequence::try_from (tables).unwrap();
985985 /// ```
986986 ///
987987 /// The following may be preferred to the previous example, and more closely
@@ -997,8 +997,7 @@ impl TreeSequence {
997997 ///
998998 /// ```should_panic
999999 /// let mut tables = tskit::TableCollection::new(1000.).unwrap();
1000- /// let tree_sequence = tskit::TreeSequence::new(tables,
1001- /// tskit::TreeSequenceFlags::default()).unwrap();
1000+ /// let tree_sequence = tskit::TreeSequence::try_from(tables).unwrap();
10021001 /// ```
10031002 ///
10041003 /// ## Note
@@ -1269,6 +1268,14 @@ impl TreeSequence {
12691268 }
12701269}
12711270
1271+ impl TryFrom < TableCollection > for TreeSequence {
1272+ type Error = TskitError ;
1273+
1274+ fn try_from ( value : TableCollection ) -> Result < Self , Self :: Error > {
1275+ Self :: new ( value, TreeSequenceFlags :: default ( ) )
1276+ }
1277+ }
1278+
12721279impl TableAccess for TreeSequence {
12731280 fn edges ( & self ) -> EdgeTable {
12741281 EdgeTable :: new_from_table ( unsafe { & ( * ( * self . inner ) . tables ) . edges } )
You can’t perform that action at this time.
0 commit comments