1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
// SPDX-License-Identifier: MIT
// Copyright 2026 Tom F. <https://github.com/tomtom215/>
// My way of giving something small back to the open source community
// and encouraging more Rust development!
//! Safe helpers for reading from and writing to `DuckDB` data vectors.
//!
//! `DuckDB` represents columnar data as "vectors" — arrays of typed values
//! with an associated validity bitmap for NULL tracking. This module provides
//! safe wrappers that eliminate the raw pointer arithmetic and undocumented
//! struct layouts that trip up extension authors.
//!
//! # Pitfalls solved by this module
//!
//! - **L4**: `ensure_validity_writable` — [`VectorWriter`] calls this automatically
//! before any NULL-setting operation.
//! - **L5**: Boolean reading — [`VectorReader`] always reads bytes as `u8 != 0`,
//! never as `bool`, preventing undefined behaviour.
//! - **P7**: `duckdb_string_t` format — [`string`] handles both the inline (≤12 bytes)
//! and pointer (>12 bytes) cases.
pub use VectorReader;
pub use ;
pub use StructReader;
pub use StructWriter;
pub use ValidityBitmap;
pub use VectorWriter;
/// Returns the default vector size used by `DuckDB` (typically 2048).
/// Returns the logical type of a vector.
///
/// # Safety
/// `vector` must be a valid `duckdb_vector`.
pub unsafe