Skip to content

refactor: properly re-export streaming_iterator types #763

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/haploid_wright_fisher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,7 @@ fn stress_test_total_branch_length() {
// stress test the branch length fn b/c it is not a trivial
// wrapper around the C API.
{
use streaming_iterator::StreamingIterator;
use tskit::StreamingIterator;
let mut x = f64::NAN;
if let Ok(mut tree_iter) = ts.tree_iterator(0) {
// We will only do the first tree to save time.
Expand Down
2 changes: 1 addition & 1 deletion src/edge_differences.rs
Original file line number Diff line number Diff line change
Expand Up @@ -236,7 +236,7 @@ impl EdgeDifferencesIterator {
}
}

impl streaming_iterator::StreamingIterator for EdgeDifferencesIterator {
impl crate::StreamingIterator for EdgeDifferencesIterator {
type Item = EdgeDifferencesIterator;

fn advance(&mut self) {
Expand Down
2 changes: 1 addition & 1 deletion src/edge_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ impl PartialEq<EdgeTableRowView<'_>> for EdgeTableRow {
}
}

impl streaming_iterator::StreamingIterator for EdgeTableRowView<'_> {
impl crate::StreamingIterator for EdgeTableRowView<'_> {
type Item = Self;

row_lending_iterator_get!();
Expand Down
2 changes: 1 addition & 1 deletion src/individual_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ impl PartialEq<IndividualTableRowView<'_>> for IndividualTableRow {
}
}

impl streaming_iterator::StreamingIterator for IndividualTableRowView<'_> {
impl crate::StreamingIterator for IndividualTableRowView<'_> {
type Item = Self;

row_lending_iterator_get!();
Expand Down
5 changes: 4 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,9 @@
#[cfg(feature = "bindings")]
pub use sys::bindings;

pub use streaming_iterator::DoubleEndedStreamingIterator;
pub use streaming_iterator::StreamingIterator;

mod _macros; // Starts w/_ to be sorted at front by rustfmt!
mod edge_differences;
mod edge_table;
Expand Down Expand Up @@ -117,9 +120,9 @@ pub use site_table::{SiteTable, SiteTableRow};
pub use sys::flags::*;
pub use sys::NodeTraversalOrder;
pub use table_collection::TableCollection;
pub use traits::TableColumn;
pub use traits::IndividualLocation;
pub use traits::IndividualParents;
pub use traits::TableColumn;
pub use trees::{Tree, TreeSequence};

// Optional features
Expand Down
2 changes: 1 addition & 1 deletion src/migration_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ impl PartialEq<MigrationTableRowView<'_>> for MigrationTableRow {
}
}

impl streaming_iterator::StreamingIterator for MigrationTableRowView<'_> {
impl crate::StreamingIterator for MigrationTableRowView<'_> {
type Item = Self;

row_lending_iterator_get!();
Expand Down
2 changes: 1 addition & 1 deletion src/mutation_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ impl PartialEq<MutationTableRowView<'_>> for MutationTableRow {
}
}

impl streaming_iterator::StreamingIterator for MutationTableRowView<'_> {
impl crate::StreamingIterator for MutationTableRowView<'_> {
type Item = Self;

row_lending_iterator_get!();
Expand Down
2 changes: 1 addition & 1 deletion src/node_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ impl PartialEq<NodeTableRowView<'_>> for NodeTableRow {
}
}

impl streaming_iterator::StreamingIterator for NodeTableRowView<'_> {
impl crate::StreamingIterator for NodeTableRowView<'_> {
type Item = Self;

row_lending_iterator_get!();
Expand Down
2 changes: 1 addition & 1 deletion src/population_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ impl PartialEq<PopulationTableRowView<'_>> for PopulationTableRow {
}
}

impl streaming_iterator::StreamingIterator for PopulationTableRowView<'_> {
impl crate::StreamingIterator for PopulationTableRowView<'_> {
type Item = Self;

row_lending_iterator_get!();
Expand Down
4 changes: 2 additions & 2 deletions src/prelude.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
//! Export commonly-use types and traits

pub use streaming_iterator::DoubleEndedStreamingIterator;
pub use streaming_iterator::StreamingIterator;
pub use crate::DoubleEndedStreamingIterator;
pub use crate::StreamingIterator;
pub use {
crate::EdgeId, crate::IndividualId, crate::Location, crate::MigrationId, crate::MutationId,
crate::NodeId, crate::PopulationId, crate::Position, crate::RawFlags, crate::SiteId,
Expand Down
4 changes: 2 additions & 2 deletions src/provenance.rs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@ impl PartialEq<ProvenanceTableRowView<'_>> for ProvenanceTableRow {
}
}

impl streaming_iterator::StreamingIterator for ProvenanceTableRowView<'_> {
impl crate::StreamingIterator for ProvenanceTableRowView<'_> {
type Item = Self;

row_lending_iterator_get!();
Expand Down Expand Up @@ -286,7 +286,7 @@ impl ProvenanceTable {

#[cfg(test)]
mod test_provenances {
use streaming_iterator::StreamingIterator;
use crate::StreamingIterator;

#[test]
fn test_empty_record_string() {
Expand Down
2 changes: 1 addition & 1 deletion src/site_table.rs
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ impl PartialEq<SiteTableRowView<'_>> for SiteTableRow {
}
}

impl streaming_iterator::StreamingIterator for SiteTableRowView<'_> {
impl crate::StreamingIterator for SiteTableRowView<'_> {
type Item = Self;

row_lending_iterator_get!();
Expand Down
2 changes: 1 addition & 1 deletion src/table_collection.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1631,7 +1631,7 @@ impl TableCollection {
where
P: Into<Position>,
{
use streaming_iterator::StreamingIterator;
use crate::StreamingIterator;
let mut tables = self;
// use tables from sys to allow easier process with metadata
let options = 0;
Expand Down
30 changes: 15 additions & 15 deletions src/trees/tree.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ impl<'treeseq> Tree<'treeseq> {
/// An error will be returned if ['crate::TreeFlags::SAMPLE_LISTS`] is not used:
///
/// ```should_panic
/// use streaming_iterator::StreamingIterator;
/// use tskit::StreamingIterator;
/// let tables = tskit::TableCollection::new(1.).unwrap();
/// let treeseq =
/// tables.tree_sequence(tskit::TreeSequenceFlags::BUILD_INDEXES).unwrap();
Expand All @@ -94,7 +94,7 @@ impl<'treeseq> Tree<'treeseq> {
/// The lifetime of the slice is tied to the parent object:
///
/// ```compile_fail
/// use streaming_iterator::StreamingIterator;
/// use tskit::StreamingIterator;
/// let tables = tskit::TableCollection::new(1.).unwrap();
/// let treeseq =
/// tables.tree_sequence(tskit::TreeSequenceFlags::BUILD_INDEXES).unwrap();
Expand Down Expand Up @@ -204,7 +204,7 @@ impl<'treeseq> Tree<'treeseq> {
/// The lifetime of the slice is tied to the parent object:
///
/// ```compile_fail
/// use streaming_iterator::StreamingIterator;
/// use tskit::StreamingIterator;
/// let tables = tskit::TableCollection::new(1.).unwrap();
/// let treeseq =
/// tables.tree_sequence(tskit::TreeSequenceFlags::BUILD_INDEXES).unwrap();
Expand All @@ -224,7 +224,7 @@ impl<'treeseq> Tree<'treeseq> {
/// The lifetime of the slice is tied to the parent object:
///
/// ```compile_fail
/// use streaming_iterator::StreamingIterator;
/// use tskit::StreamingIterator;
/// let tables = tskit::TableCollection::new(1.).unwrap();
/// let treeseq =
/// tables.tree_sequence(tskit::TreeSequenceFlags::BUILD_INDEXES).unwrap();
Expand All @@ -244,7 +244,7 @@ impl<'treeseq> Tree<'treeseq> {
/// The lifetime of the slice is tied to the parent object:
///
/// ```compile_fail
/// use streaming_iterator::StreamingIterator;
/// use tskit::StreamingIterator;
/// let tables = tskit::TableCollection::new(1.).unwrap();
/// let treeseq =
/// tables.tree_sequence(tskit::TreeSequenceFlags::BUILD_INDEXES).unwrap();
Expand All @@ -264,7 +264,7 @@ impl<'treeseq> Tree<'treeseq> {
/// The lifetime of the slice is tied to the parent object:
///
/// ```compile_fail
/// use streaming_iterator::StreamingIterator;
/// use tskit::StreamingIterator;
/// let tables = tskit::TableCollection::new(1.).unwrap();
/// let treeseq =
/// tables.tree_sequence(tskit::TreeSequenceFlags::BUILD_INDEXES).unwrap();
Expand All @@ -284,7 +284,7 @@ impl<'treeseq> Tree<'treeseq> {
/// The lifetime of the slice is tied to the parent object:
///
/// ```compile_fail
/// use streaming_iterator::StreamingIterator;
/// use tskit::StreamingIterator;
/// let tables = tskit::TableCollection::new(1.).unwrap();
/// let treeseq =
/// tables.tree_sequence(tskit::TreeSequenceFlags::BUILD_INDEXES).unwrap();
Expand Down Expand Up @@ -340,7 +340,7 @@ impl<'treeseq> Tree<'treeseq> {
/// An error will be returned if ['crate::TreeFlags::SAMPLE_LISTS`] is not used:
///
/// ```should_panic
/// use streaming_iterator::StreamingIterator;
/// use tskit::StreamingIterator;
/// let tables = tskit::TableCollection::new(1.).unwrap();
/// let treeseq =
/// tables.tree_sequence(tskit::TreeSequenceFlags::BUILD_INDEXES).unwrap();
Expand All @@ -354,7 +354,7 @@ impl<'treeseq> Tree<'treeseq> {
/// The lifetime of the slice is tied to the parent object:
///
/// ```compile_fail
/// use streaming_iterator::StreamingIterator;
/// use tskit::StreamingIterator;
/// let tables = tskit::TableCollection::new(1.).unwrap();
/// let treeseq =
/// tables.tree_sequence(tskit::TreeSequenceFlags::BUILD_INDEXES).unwrap();
Expand All @@ -374,7 +374,7 @@ impl<'treeseq> Tree<'treeseq> {
/// An error will be returned if ['crate::TreeFlags::SAMPLE_LISTS`] is not used:
///
/// ```should_panic
/// use streaming_iterator::StreamingIterator;
/// use tskit::StreamingIterator;
/// let tables = tskit::TableCollection::new(1.).unwrap();
/// let treeseq =
/// tables.tree_sequence(tskit::TreeSequenceFlags::BUILD_INDEXES).unwrap();
Expand All @@ -388,7 +388,7 @@ impl<'treeseq> Tree<'treeseq> {
/// The lifetime of the slice is tied to the parent object:
///
/// ```compile_fail
/// use streaming_iterator::StreamingIterator;
/// use tskit::StreamingIterator;
/// let tables = tskit::TableCollection::new(1.).unwrap();
/// let treeseq =
/// tables.tree_sequence(tskit::TreeSequenceFlags::BUILD_INDEXES).unwrap();
Expand All @@ -408,7 +408,7 @@ impl<'treeseq> Tree<'treeseq> {
/// An error will be returned if ['crate::TreeFlags::SAMPLE_LISTS`] is not used:
///
/// ```should_panic
/// use streaming_iterator::StreamingIterator;
/// use tskit::StreamingIterator;
/// let tables = tskit::TableCollection::new(1.).unwrap();
/// let treeseq =
/// tables.tree_sequence(tskit::TreeSequenceFlags::BUILD_INDEXES).unwrap();
Expand All @@ -422,7 +422,7 @@ impl<'treeseq> Tree<'treeseq> {
/// The lifetime of the slice is tied to the parent object:
///
/// ```compile_fail
/// use streaming_iterator::StreamingIterator;
/// use tskit::StreamingIterator;
/// let tables = tskit::TableCollection::new(1.).unwrap();
/// let treeseq =
/// tables.tree_sequence(tskit::TreeSequenceFlags::BUILD_INDEXES).unwrap();
Expand Down Expand Up @@ -454,7 +454,7 @@ impl<'treeseq> Tree<'treeseq> {
}
}

impl<'ts> streaming_iterator::StreamingIterator for Tree<'ts> {
impl<'ts> crate::StreamingIterator for Tree<'ts> {
type Item = Tree<'ts>;
fn advance(&mut self) {
assert!(!self.inner.as_ptr().is_null());
Expand All @@ -480,7 +480,7 @@ impl<'ts> streaming_iterator::StreamingIterator for Tree<'ts> {
}
}

impl streaming_iterator::DoubleEndedStreamingIterator for Tree<'_> {
impl crate::DoubleEndedStreamingIterator for Tree<'_> {
fn advance_back(&mut self) {
assert!(!self.inner.as_ptr().is_null());
// SAFETY: pointer is not null.
Expand Down
10 changes: 5 additions & 5 deletions src/trees/treeseq.rs
Original file line number Diff line number Diff line change
Expand Up @@ -204,10 +204,10 @@ impl TreeSequence {
/// ```
/// // You must include streaming_iterator as a dependency
/// // and import this type.
/// use streaming_iterator::StreamingIterator;
/// use tskit::StreamingIterator;
/// // Import this to allow .next_back() for reverse
/// // iteration over trees.
/// use streaming_iterator::DoubleEndedStreamingIterator;
/// use tskit::DoubleEndedStreamingIterator;
///
/// let mut tables = tskit::TableCollection::new(1000.).unwrap();
/// tables.build_index();
Expand All @@ -222,8 +222,8 @@ impl TreeSequence {
/// A `Tree`'s lifetime is tied to that of its tree sequence:
///
/// ```compile_fail
/// # use streaming_iterator::StreamingIterator;
/// # use streaming_iterator::DoubleEndedStreamingIterator;
/// # use tskit::StreamingIterator;
/// # use tskit::DoubleEndedStreamingIterator;
/// # let mut tables = tskit::TableCollection::new(1000.).unwrap();
/// # tables.build_index();
/// let tree_sequence = tables.tree_sequence(tskit::TreeSequenceFlags::default()).unwrap();
Expand All @@ -238,7 +238,7 @@ impl TreeSequence {
/// Be sure to note the difference from the previous example.
///
/// ```no_run
/// use streaming_iterator::StreamingIterator;
/// use tskit::StreamingIterator;
///
/// let mut tables = tskit::TableCollection::new(1000.).unwrap();
/// tables.build_index();
Expand Down
2 changes: 1 addition & 1 deletion tests/book_metadata.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
#[cfg(feature = "derive")]
#[test]
fn book_mutation_metadata() {
use streaming_iterator::StreamingIterator;
use tskit::metadata::MetadataRoundtrip;
use tskit::StreamingIterator;

// ANCHOR: metadata_derive
#[derive(serde::Serialize, serde::Deserialize, tskit::metadata::MutationMetadata)]
Expand Down
4 changes: 2 additions & 2 deletions tests/test_trees.rs
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use std::sync::Arc;
use std::thread;

use streaming_iterator::DoubleEndedStreamingIterator;
use streaming_iterator::StreamingIterator;
use crate::DoubleEndedStreamingIterator;
use crate::StreamingIterator;

use tskit::prelude::*;
use tskit::NodeFlags;
Expand Down
Loading