| <!DOCTYPE html><html lang="en"><head><meta charset="utf-8"><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="rustdoc"><meta name="description" content="Contains declarations to bind to the C Stream Interface."><title>arrow_array::ffi_stream - Rust</title><script>if(window.location.protocol!=="file:")document.head.insertAdjacentHTML("beforeend","SourceSerif4-Regular-6b053e98.ttf.woff2,FiraSans-Italic-81dc35de.woff2,FiraSans-Regular-0fe48ade.woff2,FiraSans-MediumItalic-ccf7e434.woff2,FiraSans-Medium-e1aa3f0a.woff2,SourceCodePro-Regular-8badfe75.ttf.woff2,SourceCodePro-Semibold-aa29a496.ttf.woff2".split(",").map(f=>`<link rel="preload" as="font" type="font/woff2"href="../../static.files/${f}">`).join(""))</script><link rel="stylesheet" href="../../static.files/normalize-9960930a.css"><link rel="stylesheet" href="../../static.files/rustdoc-ca0dd0c4.css"><meta name="rustdoc-vars" data-root-path="../../" data-static-root-path="../../static.files/" data-current-crate="arrow_array" data-themes="" data-resource-suffix="" data-rustdoc-version="1.93.0-nightly (292be5c7c 2025-10-29)" data-channel="nightly" data-search-js="search-d69d8955.js" data-stringdex-js="stringdex-c3e638e9.js" data-settings-js="settings-c38705f0.js" ><script src="../../static.files/storage-e2aeef58.js"></script><script defer src="../sidebar-items.js"></script><script defer src="../../static.files/main-ce535bd0.js"></script><noscript><link rel="stylesheet" href="../../static.files/noscript-263c88ec.css"></noscript><link rel="icon" href="https://arrow.apache.org/img/arrow-logo_chevrons_black-txt_transparent-bg.svg"></head><body class="rustdoc mod"><!--[if lte IE 11]><div class="warning">This old browser is unsupported and will most likely display funky things.</div><![endif]--><rustdoc-topbar><h2><a href="#">Module ffi_stream</a></h2></rustdoc-topbar><nav class="sidebar"><div class="sidebar-crate"><a class="logo-container" href="../../arrow_array/index.html"><img src="https://arrow.apache.org/img/arrow-logo_chevrons_black-txt_white-bg.svg" alt="logo"></a><h2><a href="../../arrow_array/index.html">arrow_<wbr>array</a><span class="version">57.0.0</span></h2></div><div class="sidebar-elems"><section id="rustdoc-toc"><h2 class="location"><a href="#">Module ffi_<wbr>stream</a></h2><h3><a href="#structs">Module Items</a></h3><ul class="block"><li><a href="#structs" title="Structs">Structs</a></li><li><a href="#constants" title="Constants">Constants</a></li><li><a href="#functions" title="Functions">Functions</a></li><li><a href="#types" title="Type Aliases">Type Aliases</a></li></ul></section><div id="rustdoc-modnav"><h2 class="in-crate"><a href="../index.html">In crate arrow_<wbr>array</a></h2></div></div></nav><div class="sidebar-resizer" title="Drag to resize sidebar"></div><main><div class="width-limiter"><section id="main-content" class="content"><div class="main-heading"><div class="rustdoc-breadcrumbs"><a href="../index.html">arrow_array</a></div><h1>Module <span>ffi_<wbr>stream</span> <button id="copy-path" title="Copy item path to clipboard">Copy item path</button></h1><rustdoc-toolbar></rustdoc-toolbar><span class="sub-heading"><a class="src" href="../../src/arrow_array/ffi_stream.rs.html#18-534">Source</a> </span></div><details class="toggle top-doc" open><summary class="hideme"><span>Expand description</span></summary><div class="docblock"><p>Contains declarations to bind to the <a href="https://arrow.apache.org/docs/format/CStreamInterface.html">C Stream Interface</a>.</p> |
| <p>This module has two main interfaces: |
| One interface maps C ABI to native Rust types, i.e. convert c-pointers, c_char, to native rust. |
| This is handled by <a href="struct.FFI_ArrowArrayStream.html" title="struct arrow_array::ffi_stream::FFI_ArrowArrayStream">FFI_ArrowArrayStream</a>.</p> |
| <p>The second interface is used to import <code>FFI_ArrowArrayStream</code> as Rust implementation <code>RecordBatch</code> reader. |
| This is handled by <code>ArrowArrayStreamReader</code>.</p> |
| |
| <div class="example-wrap ignore"><a href="#" class="tooltip" title="This example is not tested">โ</a><pre class="rust rust-example-rendered"><code><span class="comment">// create an record batch reader natively |
| </span><span class="kw">let </span>file = File::open(<span class="string">"arrow_file"</span>).unwrap(); |
| <span class="kw">let </span>reader = Box::new(FileReader::try_new(file).unwrap()); |
| |
| <span class="comment">// export it |
| </span><span class="kw">let </span><span class="kw-2">mut </span>stream = FFI_ArrowArrayStream::empty(); |
| <span class="kw">unsafe </span>{ export_reader_into_raw(reader, <span class="kw-2">&mut </span>stream) }; |
| |
| <span class="comment">// consumed and used by something else... |
| |
| // import it |
| </span><span class="kw">let </span>stream_reader = <span class="kw">unsafe </span>{ ArrowArrayStreamReader::from_raw(<span class="kw-2">&mut </span>stream).unwrap() }; |
| <span class="kw">let </span>imported_schema = stream_reader.schema(); |
| |
| <span class="kw">let </span><span class="kw-2">mut </span>produced_batches = <span class="macro">vec!</span>[]; |
| <span class="kw">for </span>batch <span class="kw">in </span>stream_reader { |
| produced_batches.push(batch.unwrap()); |
| } |
| <span class="prelude-val">Ok</span>(()) |
| }</code></pre></div></div></details><h2 id="structs" class="section-header">Structs<a href="#structs" class="anchor">ยง</a></h2><dl class="item-table"><dt><a class="struct" href="struct.ArrowArrayStreamReader.html" title="struct arrow_array::ffi_stream::ArrowArrayStreamReader">Arrow<wbr>Array<wbr>Stream<wbr>Reader</a></dt><dd>A <code>RecordBatchReader</code> which imports Arrays from <code>FFI_ArrowArrayStream</code>.</dd><dt><a class="struct" href="struct.ExportedArrayStream.html" title="struct arrow_array::ffi_stream::ExportedArrayStream">Exported<wbr>Array<wbr>Stream</a><span title="Restricted Visibility"> ๐</span> </dt><dt><a class="struct" href="struct.FFI_ArrowArrayStream.html" title="struct arrow_array::ffi_stream::FFI_ArrowArrayStream">FFI_<wbr>Arrow<wbr>Array<wbr>Stream</a></dt><dd>ABI-compatible struct for <code>ArrayStream</code> from C Stream Interface |
| See <a href="https://arrow.apache.org/docs/format/CStreamInterface.html#structure-definitions">https://arrow.apache.org/docs/format/CStreamInterface.html#structure-definitions</a> |
| This was created by bindgen</dd><dt><a class="struct" href="struct.StreamPrivateData.html" title="struct arrow_array::ffi_stream::StreamPrivateData">Stream<wbr>Private<wbr>Data</a><span title="Restricted Visibility"> ๐</span> </dt></dl><h2 id="constants" class="section-header">Constants<a href="#constants" class="anchor">ยง</a></h2><dl class="item-table"><dt><a class="constant" href="constant.EINVAL.html" title="constant arrow_array::ffi_stream::EINVAL">EINVAL</a><span title="Restricted Visibility"> ๐</span> </dt><dt><a class="constant" href="constant.EIO.html" title="constant arrow_array::ffi_stream::EIO">EIO</a><span title="Restricted Visibility"> ๐</span> </dt><dt><a class="constant" href="constant.ENOMEM.html" title="constant arrow_array::ffi_stream::ENOMEM">ENOMEM</a><span title="Restricted Visibility"> ๐</span> </dt><dt><a class="constant" href="constant.ENOSYS.html" title="constant arrow_array::ffi_stream::ENOSYS">ENOSYS</a><span title="Restricted Visibility"> ๐</span> </dt></dl><h2 id="functions" class="section-header">Functions<a href="#functions" class="anchor">ยง</a></h2><dl class="item-table"><dt><a class="fn" href="fn.get_error_code.html" title="fn arrow_array::ffi_stream::get_error_code">get_<wbr>error_<wbr>code</a><span title="Restricted Visibility"> ๐</span> </dt><dt><a class="fn" href="fn.get_last_error.html" title="fn arrow_array::ffi_stream::get_last_error">get_<wbr>last_<wbr>error</a><span title="Restricted Visibility"> ๐</span> <sup title="unsafe function">โ </sup></dt><dt><a class="fn" href="fn.get_next.html" title="fn arrow_array::ffi_stream::get_next">get_<wbr>next</a><span title="Restricted Visibility"> ๐</span> <sup title="unsafe function">โ </sup></dt><dt><a class="fn" href="fn.get_schema.html" title="fn arrow_array::ffi_stream::get_schema">get_<wbr>schema</a><span title="Restricted Visibility"> ๐</span> <sup title="unsafe function">โ </sup></dt><dt><a class="fn" href="fn.get_stream_schema.html" title="fn arrow_array::ffi_stream::get_stream_schema">get_<wbr>stream_<wbr>schema</a><span title="Restricted Visibility"> ๐</span> </dt><dd>Gets schema from a raw pointer of <code>FFI_ArrowArrayStream</code>. This is used when constructing |
| <code>ArrowArrayStreamReader</code> to cache schema.</dd><dt><a class="fn" href="fn.release_stream.html" title="fn arrow_array::ffi_stream::release_stream">release_<wbr>stream</a><span title="Restricted Visibility"> ๐</span> <sup title="unsafe function">โ </sup></dt></dl><h2 id="types" class="section-header">Type Aliases<a href="#types" class="anchor">ยง</a></h2><dl class="item-table"><dt><a class="type" href="type.Result.html" title="type arrow_array::ffi_stream::Result">Result</a><span title="Restricted Visibility"> ๐</span> </dt></dl></section></div></main></body></html> |