Skip to content

Commit

Permalink
docs(rust): Fix inconsistency between code and comment (#20070)
Browse files Browse the repository at this point in the history
  • Loading branch information
YichiZhang0613 authored Dec 2, 2024
1 parent cd6e4a0 commit ac4822b
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions crates/polars-arrow/src/array/utf8/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ impl<O: Offset> Utf8Array<O> {
///
/// # 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
Expand Down Expand Up @@ -354,8 +354,8 @@ impl<O: Offset> Utf8Array<O> {
///
/// # 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
Expand Down Expand Up @@ -395,8 +395,8 @@ impl<O: Offset> Utf8Array<O> {
/// 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
Expand Down
6 changes: 3 additions & 3 deletions crates/polars-arrow/src/offset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -184,7 +184,7 @@ impl<O: Offset> Offsets<O> {

/// 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
Expand Down Expand Up @@ -458,7 +458,7 @@ impl<O: Offset> OffsetsBuffer<O> {

/// 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);
Expand All @@ -467,7 +467,7 @@ impl<O: Offset> OffsetsBuffer<O> {

/// 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
Expand Down

0 comments on commit ac4822b

Please sign in to comment.