From ac4822b7fea2786acf9c15476bc7aa2f4d328c52 Mon Sep 17 00:00:00 2001 From: Yichi Zhang <109252977+YichiZhang0613@users.noreply.github.com> Date: Mon, 2 Dec 2024 15:45:32 +0800 Subject: [PATCH] docs(rust): Fix inconsistency between code and comment (#20070) --- crates/polars-arrow/src/array/utf8/mod.rs | 12 ++++++------ crates/polars-arrow/src/offset.rs | 6 +++--- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/crates/polars-arrow/src/array/utf8/mod.rs b/crates/polars-arrow/src/array/utf8/mod.rs index 9cce9f749bff..fa13fa531cf9 100644 --- a/crates/polars-arrow/src/array/utf8/mod.rs +++ b/crates/polars-arrow/src/array/utf8/mod.rs @@ -75,8 +75,8 @@ impl Utf8Array { /// /// # Errors /// This function returns an error iff: - /// * The last offset is not equal to the values' length. - /// * the validity's length is not equal to `offsets.len()`. + /// * The last offset is greater than the values' length. + /// * the validity's length is not equal to `offsets.len_proxy()`. /// * The `dtype`'s [`crate::datatypes::PhysicalType`] is not equal to either `Utf8` or `LargeUtf8`. /// * The `values` between two consecutive `offsets` are not valid utf8 /// # Implementation @@ -354,8 +354,8 @@ impl Utf8Array { /// /// # Panic /// This function panics (in debug mode only) iff: - /// * The last offset is not equal to the values' length. - /// * the validity's length is not equal to `offsets.len()`. + /// * The last offset is greater than the values' length. + /// * the validity's length is not equal to `offsets.len_proxy()`. /// * The `dtype`'s [`crate::datatypes::PhysicalType`] is not equal to either `Utf8` or `LargeUtf8`. /// /// # Safety @@ -395,8 +395,8 @@ impl Utf8Array { /// Creates a new [`Utf8Array`]. /// # Panics /// This function panics iff: - /// * The last offset is not equal to the values' length. - /// * the validity's length is not equal to `offsets.len()`. + /// * The last offset is greater than the values' length. + /// * the validity's length is not equal to `offsets.len_proxy()`. /// * The `dtype`'s [`crate::datatypes::PhysicalType`] is not equal to either `Utf8` or `LargeUtf8`. /// * The `values` between two consecutive `offsets` are not valid utf8 /// # Implementation diff --git a/crates/polars-arrow/src/offset.rs b/crates/polars-arrow/src/offset.rs index 6204d443c87d..4153579a0339 100644 --- a/crates/polars-arrow/src/offset.rs +++ b/crates/polars-arrow/src/offset.rs @@ -184,7 +184,7 @@ impl Offsets { /// Returns a range (start, end) corresponding to the position `index` /// # Panic - /// This function panics iff `index >= self.len()` + /// This function panics iff `index >= self.len_proxy()` #[inline] pub fn start_end(&self, index: usize) -> (usize, usize) { // soundness: the invariant of the function @@ -458,7 +458,7 @@ impl OffsetsBuffer { /// Returns a `length` corresponding to the position `index` /// # Panic - /// This function panics iff `index >= self.len()` + /// This function panics iff `index >= self.len_proxy()` #[inline] pub fn length_at(&self, index: usize) -> usize { let (start, end) = self.start_end(index); @@ -467,7 +467,7 @@ impl OffsetsBuffer { /// Returns a range (start, end) corresponding to the position `index` /// # Panic - /// This function panics iff `index >= self.len()` + /// This function panics iff `index >= self.len_proxy()` #[inline] pub fn start_end(&self, index: usize) -> (usize, usize) { // soundness: the invariant of the function