Skip to main content

Crate rayforce

Crate rayforce 

Source
Expand description

Convenient, high-performance Rust bindings for RayforceDB v2.

Binds the core ray_* C API directly (via rayforce_sys); see PLAN.md for the roadmap. The crate is single-threaded by construction: the core runs on one thread with a thread-local VM and allows a single live Runtime per process. Runtime::scope brackets it: the closure gets a &Runtime for as long as it runs, and everything built inside is torn down with it.

rayforce::Runtime::scope(|rt| {
    let two = rt.eval("(+ 1 1)")?;
    assert_eq!(two.format(), "2");
    Ok(())
})

Re-exports§

pub use q::QConnection;
pub use rayforce_sys as sys;

Modules§

q
Q IPC client — connect to a Q server, send a query, get the response decoded into a rayforce Value.

Structs§

Fn
A compiled RayforceDB lambda function.
Guid
Wrapper carrying 16 raw GUID bytes.
RayError
An error returned by a RayforceDB operation.
Runtime
A live RayforceDB runtime. Obtained only from Runtime::scope, and only as a shared reference — you cannot own one, so you cannot drop one.
Select
A select query builder.
Str
Wrapper that maps a string to a string atom (-RAY_STR) rather than the default symbol mapping of bare &str.
Table
A RayforceDB table.
TcpClient
A synchronous IPC connection to a RayforceDB server.
Update
An update query builder.
Value
A handle to a RayforceDB object (atom, vector, list, dict, table, …).
VecIter
Iterator over a vector’s boxed elements.

Enums§

ErrorCode
A categorized RayforceDB error code (mirrors the core ray_err_t enum and the short codes carried by RAY_ERROR objects).
Expr
A node in the query expression tree.
Operation
A RayforceDB builtin operation.

Traits§

FromValue
Extract a Rust value from a Value.
IntoExpr
Anything convertible into an Expr operand: another Expr, a literal scalar, or a Value.
ToValue
Build a Value from a Rust value.
VecElem
A fixed-width vector element type, mapping a Rust scalar to a core vector type tag for zero-copy slicing and bulk construction.

Functions§

avg
col
A column / global name reference.
count
distinct
eval
Evaluate a Rayfall source string. Requires a live Runtime on this thread.
eval_value
Evaluate an already-compiled AST Value (e.g. a query). Requires a live Runtime on this thread.
first
get_global
Look up a global binding. Requires a live Runtime on this thread.
last
lit
A literal value from any ToValue.
max
median
min
on_runtime_thread
Is this the thread that owns the live runtime?
set_global
Bind value to a global name. Requires a live Runtime on this thread.
sum

Type Aliases§

Result
Convenience result alias for the crate.