type-erased-table

Crates.iotype-erased-table
lib.rstype-erased-table
version0.1.0
sourcesrc
created_at2024-06-14 12:27:47.556459
updated_at2024-06-14 12:27:47.556459
descriptionA column-oriented based raw data storage
homepage
repository
max_upload_size
id1271940
size14,336
Valentin (ValentinRio)

documentation

README


type-erased-table

crates.io docs.rs

A column-oriented based raw data storage
Report Bug

Table of Contents
  1. About The Project
  2. Getting Started
  3. Usage
  4. Contributing
  5. License
  6. Contact

About The Project

Allow to create Table like structure represented by a structure of Arrays maintaining multiple arrays of different types while maintaining the same size for all the arrays and a shared index for each attribute created throughout its lifetime.

Provide a Table struct that allows to store rows of data composed of different types. This structure can be represented as a Structure of arrays and is built has an HashMap where keys are column identifiers and values are Column. Each Column is a contiguous array and every row component can be accessed with the same index on each Column.

(back to top)

Built With

(back to top)

Getting Started

This is an example of how you use this crate to to create a table struct with a simple columns.

Installation

Add dependency to you cargo.toml

[dependencies]
type-erased-table = "0.1.0"

(back to top)

Usage

After creating a table just add a column and start filling it with un-typed data.

let mut table = Table::new(1);

let value: u32 = 2;

// Get Layout from concrete type
let layout = Layout::for_value(&value);

// Create column with u32 identifier
let column_info = ColumnInfo::new(1, layout);

table.add_column(column_info);

let column = table.get_column_mut(1).unwrap();

// Push data into row of column by passing pointer as *const u8
unsafe { column.push(ptr::addr_of!(value) as *const u8) }

// Read value of row 0
let row_ptr = unsafe { column.get(0) };
let row_value: u32 = unsafe { (*row_ptr).into() };

(back to top)

Contributing

Contributions are what make the open source community such an amazing place to learn, inspire, and create. Any contributions you make are greatly appreciated.

If you have a suggestion that would make this better, please fork the repo and create a pull request. Don't forget to give the project a star! Thanks again!

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

(back to top)

License

Distributed under the MIT License.

(back to top)

Contact

Project Link: https://github.com/ValentinRio/type-erased-table

(back to top)

Commit count: 0

cargo fmt