Benign crates 904,687 installs Download

polars-ffi 0.38.1

“FFI utils for the Polars project.”

Rust test marker or harnessimports arrow::ffi
SHA-256d8860e865f65b31feb01cb4b83fa0cef20ed1717112d619117c13e6422529c7f

Evidence

imports arrow::ffi::ArrowArray lib.rs · lines 1–34
1pub mod version_0;
2
3use std::mem::ManuallyDrop;
4
5use arrow::array::ArrayRef;
6use arrow::ffi;
7use arrow::ffi::{ArrowArray, ArrowSchema};
8use polars_core::error::PolarsResult;
9use polars_core::prelude::{ArrowField, Series};
10
11pub const MAJOR: u16 = 0;
⋯4 lines
16}
17
18// A utility that helps releasing/owning memory.
19#[allow(dead_code)]
20struct PrivateData {
21 schema: Box<ArrowSchema>,
22 arrays: Box<[*mut ArrowArray]>,
23}
24
25/// # Safety
26/// `ArrowArray` and `ArrowSchema` must be valid
27unsafe fn import_array(
28 array: ffi::ArrowArray,
⋯6 lines
imports super::* version_0.rs · lines 1–11
1use super::*;
2
3/// An FFI exported `Series`.
4#[repr(C)]
5pub struct SeriesExport {
6 field: *mut ArrowSchema,
7 // A double ptr, so we can easily release the buffer
8 // without dropping the arrays.
9 arrays: *mut *mut ArrowArray,
10 len: usize,
11 …
English function-word token "for" version_0.rs · lines 27–34
27:8… self.private_data.is_null()
28 }
29}
30
31impl Drop for SeriesExport {
32 fn drop(&mut self) {
33 if let Some(release) = self.release {
34 …
Data-access verb token version_0.rs · lines 100–110
100:2… let e = std::ptr::read(e.add(i));
101 out.push(import_series(e)?)
102 }
103 Ok(out)
104}
105
106/// Passed to an expression.
107/// This contains information for the implementer of the expression on what it is allowed to do.
108#[derive(Copy, Clone, Debug, Default)]
109#[repr(C)]
110pub struct CallerContext {
imports polars_core::prelude::* version_0.rs · lines 132–152
132:12… _set_parallel(&mut self) {
133 self.set_kth_bit(0)
134 }
135}
136
137#[cfg(test)]
138mod test {
139 use polars_core::prelude::*;
140
141 use super::*;
142
143 #[test]
144 fn test_ffi() {
145 let s = Series::new("a", [1, 2]);
146 let e = export_series(&s);
147
148 unsafe {
149 assert_eq!(import_series(e).unwrap(), s);
150 };
151 }
152}

No evidence locations were recorded for this file. Raw result

Keyboard shortcuts on this page: j for the next sample, k for the previous one, x to go back to the feed, d to download the original bytes, r to re-queue the sample for analysis.