diff --git a/crates/iceberg/src/spec/schema.rs b/crates/iceberg/src/spec/schema.rs index cf86874dc..eaf1fcc85 100644 --- a/crates/iceberg/src/spec/schema.rs +++ b/crates/iceberg/src/spec/schema.rs @@ -358,7 +358,7 @@ impl Schema { /// Returns [`identifier_field_ids`]. #[inline] - pub fn identifier_field_ids(&self) -> impl Iterator + '_ { + pub fn identifier_field_ids(&self) -> impl ExactSizeIterator + '_ { self.identifier_field_ids.iter().copied() } diff --git a/crates/iceberg/src/spec/table_metadata.rs b/crates/iceberg/src/spec/table_metadata.rs index 74e690077..daed758cb 100644 --- a/crates/iceberg/src/spec/table_metadata.rs +++ b/crates/iceberg/src/spec/table_metadata.rs @@ -203,7 +203,7 @@ impl TableMetadata { /// Returns schemas #[inline] - pub fn schemas_iter(&self) -> impl Iterator { + pub fn schemas_iter(&self) -> impl ExactSizeIterator { self.schemas.values() } @@ -228,7 +228,9 @@ impl TableMetadata { /// Returns all partition specs. #[inline] - pub fn partition_specs_iter(&self) -> impl Iterator { + pub fn partition_specs_iter( + &self, + ) -> impl ExactSizeIterator { self.partition_specs.values() } @@ -252,7 +254,7 @@ impl TableMetadata { /// Returns all snapshots #[inline] - pub fn snapshots(&self) -> impl Iterator { + pub fn snapshots(&self) -> impl ExactSizeIterator { self.snapshots.values() } @@ -301,7 +303,7 @@ impl TableMetadata { /// Return all sort orders. #[inline] - pub fn sort_orders_iter(&self) -> impl Iterator { + pub fn sort_orders_iter(&self) -> impl ExactSizeIterator { self.sort_orders.values() } diff --git a/crates/iceberg/src/spec/values.rs b/crates/iceberg/src/spec/values.rs index 3c6e2aa68..552ac497f 100644 --- a/crates/iceberg/src/spec/values.rs +++ b/crates/iceberg/src/spec/values.rs @@ -1560,7 +1560,7 @@ impl Struct { } /// Create a iterator to read the field in order of field_value. - pub fn iter(&self) -> impl Iterator> { + pub fn iter(&self) -> impl ExactSizeIterator> { self.null_bitmap.iter().zip(self.fields.iter()).map( |(null, value)| { if *null { diff --git a/crates/iceberg/src/spec/view_metadata.rs b/crates/iceberg/src/spec/view_metadata.rs index 741e38649..7c247c17d 100644 --- a/crates/iceberg/src/spec/view_metadata.rs +++ b/crates/iceberg/src/spec/view_metadata.rs @@ -94,7 +94,7 @@ impl ViewMetadata { /// Returns all view versions. #[inline] - pub fn versions(&self) -> impl Iterator { + pub fn versions(&self) -> impl ExactSizeIterator { self.versions.values() } @@ -114,7 +114,7 @@ impl ViewMetadata { /// Returns schemas #[inline] - pub fn schemas_iter(&self) -> impl Iterator { + pub fn schemas_iter(&self) -> impl ExactSizeIterator { self.schemas.values() }