Skip to content
This repository was archived by the owner on Jun 20, 2022. It is now read-only.

Commit 355b72c

Browse files
committed
Setup packages
1 parent 063bc25 commit 355b72c

File tree

6 files changed

+107
-0
lines changed

6 files changed

+107
-0
lines changed

Cargo.toml

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,37 @@
1+
[workspace]
2+
members = [
3+
"narrow-derive"
4+
]
5+
6+
[package]
7+
name = "narrow"
8+
version = "0.1.0"
9+
authors = ["Matthijs Brobbel <[email protected]>"]
10+
edition = "2018"
11+
description = "A Rust implementation of Apache Arrow"
12+
readme = "README.md"
13+
repository = "https://github.com/mbrobbel/narrow"
14+
license = "Apache-2.0 or MIT"
15+
keywords = ["Arrow"]
16+
categories = ["data-structures"]
17+
18+
[features]
19+
default = []
20+
21+
[dependencies]
22+
narrow-derive = { path = "narrow-derive", version = "0.1.0" }
23+
24+
[dev-dependencies]
25+
criterion = "0.3"
26+
27+
[profile.release]
28+
lto = true
29+
codegen-units = 1
30+
31+
[profile.bench]
32+
lto = true
33+
codegen-units = 1
34+
35+
[[bench]]
36+
name = "narrow"
37+
harness = false

benches/narrow/array/mod.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
use criterion::Criterion;
2+
3+
pub(super) fn bench(_c: &mut Criterion) {}

benches/narrow/main.rs

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
use criterion::{criterion_group, criterion_main, Criterion};
2+
3+
mod array;
4+
5+
criterion_group! {
6+
name = narrow;
7+
config = Criterion::default();
8+
targets =
9+
array::bench
10+
}
11+
criterion_main!(narrow);

narrow-derive/Cargo.toml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
[package]
2+
name = "narrow-derive"
3+
version = "0.1.0"
4+
authors = ["Matthijs Brobbel <[email protected]>"]
5+
edition = "2018"
6+
7+
[lib]
8+
proc-macro = true
9+
10+
[features]
11+
12+
[dependencies]
13+
proc-macro2 = "1"
14+
quote = "1"
15+
syn = { version = "1", features = ["derive", "full", "parsing", "extra-traits"] }

narrow-derive/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+

src/lib.rs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
//! # narrow
2+
//!
3+
//! A Rust implementation of Apache Arrow.
4+
5+
use std::ops::{Add, AddAssign, Sub};
6+
7+
// Hidden re-exports of types used in the `narrow-derive` crate.
8+
#[doc(hidden)]
9+
pub mod re_exports {
10+
extern crate self as narrow;
11+
}
12+
13+
pub use narrow_derive::*;
14+
15+
/// Subtrait for primitive types.
16+
///
17+
/// This exists to use as trait bound where one or more of the supertraits of
18+
/// this trait are required, and to restrict certain implementations to Arrow
19+
/// primitive types.
20+
pub trait Primitive:
21+
Add<Output = Self> + AddAssign + Copy + Default + Sub<Output = Self> + sealed::SealedPrimitive
22+
{
23+
}
24+
25+
impl Primitive for i8 {}
26+
impl Primitive for i16 {}
27+
impl Primitive for i32 {}
28+
impl Primitive for i64 {}
29+
impl Primitive for u8 {}
30+
impl Primitive for u16 {}
31+
impl Primitive for u32 {}
32+
impl Primitive for u64 {}
33+
impl Primitive for f32 {}
34+
impl Primitive for f64 {}
35+
36+
// Sealed traits.
37+
mod sealed {
38+
pub trait SealedPrimitive {}
39+
impl<T> SealedPrimitive for T where T: crate::Primitive {}
40+
}

0 commit comments

Comments
 (0)