Safe Rust bindings for RayforceDB¶
The ultra-fast columnar database, now with Rust's safety guarantees. Zero-cost abstractions, memory safety, and fearless concurrency.
Why rayforce-rs?¶
-
Memory Safe
Full Rust safety guarantees. No null pointers, no buffer overflows, no data races. The borrow checker ensures correctness at compile time.
-
Zero-Cost Abstractions
Idiomatic Rust API that compiles down to efficient C calls. Pay only for what you use, with no runtime overhead.
-
Ergonomic API
Type-safe wrappers for all RayforceDB types.
RayI64,RayVector,RayTable- all with familiar Rust traits. -
Full Feature Parity
Complete coverage of RayforceDB functionality: tables, queries, joins, aggregations, and IPC communication.
-
IPC Support
Connect to remote RayforceDB instances with async-ready connection handling. Perfect for distributed systems.
-
MIT Licensed
Open source and free to use. Contribute on GitHub and help shape the future of Rust database bindings.
Expressive. Type-Safe. Fast.
Experience the power of RayforceDB with Rust's elegant syntax and safety guarantees.
use rayforce::{Rayforce, RayI64, RaySymbol, RayObj};
fn main() -> Result<(), Box<dyn std::error::Error>> {
// Initialize the RayforceDB runtime
let ray = Rayforce::new()?;
// Create typed scalar values
let x = RayI64::from_value(42);
let y = RayI64::from_value(100);
// Create symbols
let name = RaySymbol::new("price");
// Evaluate expressions
let result = ray.eval("(+ 1 2 3)")?;
println!("Result: {}", result); // → 6
Ok(())
}
use rayforce::{Rayforce, RayVector, RayList, RayString};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let ray = Rayforce::new()?;
// Create vectors from iterators
let prices: RayVector<i64> = RayVector::from_iter(
[100, 200, 300, 150, 250]
);
let quantities: RayVector<f64> = RayVector::from_iter(
[1.5, 2.0, 3.5, 1.0, 4.0]
);
// Create heterogeneous lists
let mut list = RayList::new();
list.push(RayObj::from(42_i64));
list.push(RayObj::from("hello"));
list.push(RayObj::from(3.14_f64));
// Create strings
let greeting = RayString::from("Hello, RayforceDB!");
println!("String: {}", greeting);
Ok(())
}
use rayforce::{Rayforce, RayTable, RayColumn, RayVector};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let ray = Rayforce::new()?;
// Create a table with typed columns
let employees = RayTable::builder()
.column("name", vec!["Alice", "Bob", "Charlie"])
.column("dept", vec!["IT", "HR", "IT"])
.column("salary", vec![75000_i64, 65000, 85000])
.build()?;
// Access columns
let salaries = employees.column("salary")?;
println!("Salaries: {:?}", salaries);
// Get table dimensions
println!("Rows: {}, Cols: {}",
employees.nrows(),
employees.ncols()
);
Ok(())
}
use rayforce::{Rayforce, RayTable, RaySelectQuery};
fn main() -> Result<(), Box<dyn std::error::Error>> {
let ray = Rayforce::new()?;
// Create employees table
let employees = RayTable::from_eval(&ray, r#"
(table [name dept salary]
(list
["Alice" "Bob" "Charlie" "David"]
['IT 'HR 'IT 'Sales]
[75000 65000 85000 70000]))
"#)?;
// Select with filtering
let high_earners = employees
.select()
.columns(["name", "salary"])
.filter("(> salary 70000)")
.execute()?;
// Group by with aggregation
let by_dept = employees
.select()
.agg("avg_salary", "(avg salary)")
.agg("count", "(count name)")
.group_by("dept")
.execute()?;
Ok(())
}
Part of the RayforceDB Ecosystem¶
-
RayforceDB Core
The blazing-fast C library powering it all. Under 1MB binary, zero dependencies, sub-millisecond queries.
-
Python Bindings
Native Python integration through FFI. Use RayforceDB in your data science and ML workflows.
-
WebAssembly
Run RayforceDB in your browser. Try the interactive WASM playground with zero installation.
Ready to get started?¶
Add rayforce-rs to your Cargo.toml and start building high-performance database applications in Rust.