Skip to content

Commit

Permalink
using trait from alloy.rs
Browse files Browse the repository at this point in the history
  • Loading branch information
Ignalina committed Oct 24, 2022
1 parent ece5765 commit 4841020
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 0 deletions.
10 changes: 10 additions & 0 deletions ffi/rust/Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions ffi/rust/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,5 @@ crate-type = ["staticlib"]
libc = "0.2.2"
arrow2 = "0.14.2"
chrono = "0.4.22"
arrowalloy = "0.0.3"

23 changes: 23 additions & 0 deletions ffi/rust/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ use arrow2::datatypes::Field;
use arrow2::ffi;
use libc::c_uint;
use chrono::offset::Local;
use arrowalloy::api::OneShot;

macro_rules! info {
($($arg:tt)*) => {
Expand All @@ -38,6 +39,28 @@ macro_rules! info {
);
}
}
struct DummyBackend {
ddlname: String,
}

impl OneShot for DummyBackend {
fn set_lib(&self) -> usize {
1

}

fn from_chunks(&self, arrays: Vec<Box<dyn Array>>) -> usize {

info!("Hello! Once you Go Rust you never Go Back !");

for (i, array) in arrays.iter().enumerate() {
info!("array{}: {:?}", i + 1, array);
}

arrays.len()
}
}


#[no_mangle]
pub unsafe extern "C" fn from_chunks_ffi(
Expand Down

0 comments on commit 4841020

Please sign in to comment.