Skip to content

Commit

Permalink
Publicly document MutableBinaryViewArray invariants
Browse files Browse the repository at this point in the history
These invariants are referenced from the safety documentation of several publicly-exposed methods. This information should therefore be public so that callers can ensure correct usage.
  • Loading branch information
cramertj authored Jan 2, 2025
1 parent 11fa6de commit ce02a54
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions crates/polars-arrow/src/array/binview/mutable.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,11 @@ use crate::trusted_len::TrustedLen;
const DEFAULT_BLOCK_SIZE: usize = 8 * 1024;
const MAX_EXP_BLOCK_SIZE: usize = 16 * 1024 * 1024;

// Invariants:
//
// - Each view must point to a valid slice of a buffer
// - `total_buffer_len` must be equal to `completed_buffers.iter().map(Vec::len).sum()`
// - `total_bytes_len` must be equal to `views.iter().map(View::len).sum()`
/// # Safety invariants
///
/// - Each view must point to a valid slice of a buffer
/// - `total_buffer_len` must be equal to `completed_buffers.iter().map(Vec::len).sum()`
/// - `total_bytes_len` must be equal to `views.iter().map(View::len).sum()`
pub struct MutableBinaryViewArray<T: ViewType + ?Sized> {
pub(crate) views: Vec<View>,
pub(crate) completed_buffers: Vec<Buffer<u8>>,
Expand Down

0 comments on commit ce02a54

Please sign in to comment.