From ce02a5458bdc7c6af02f12e47db8a81eed8af7db Mon Sep 17 00:00:00 2001 From: Taylor Cramer Date: Thu, 2 Jan 2025 10:01:22 -0800 Subject: [PATCH] Publicly document MutableBinaryViewArray invariants 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. --- crates/polars-arrow/src/array/binview/mutable.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/crates/polars-arrow/src/array/binview/mutable.rs b/crates/polars-arrow/src/array/binview/mutable.rs index 0e8469719417..d7d24a1bec9e 100644 --- a/crates/polars-arrow/src/array/binview/mutable.rs +++ b/crates/polars-arrow/src/array/binview/mutable.rs @@ -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 { pub(crate) views: Vec, pub(crate) completed_buffers: Vec>,