Rust API Overview
Public API surface of the krishiv-api crate.
Overview
The krishiv-api crate is the user-facing Rust API. It re-exports every public type at the crate root. Add it to your Cargo.toml:
[dependencies]
krishiv = { path = "../krishiv", features = ["embedded"] }
Or use the api crate directly:
[dependencies]
krishiv-api = { path = "../crates/krishiv-api" }
Key Top-Level Exports
| Type / Function | Description |
|---|---|
Session, SessionBuilder | Entry point for all Krishiv workloads. |
DataFrame, GroupedDataFrame | Lazy query plan builder. |
Stream, KeyedStream | Streaming data pipeline builder. |
IncrementalFlow | Incremental view maintenance. |
WindowedStream, SessionWindowedStream, SlidingWindowedStream | Windowed streaming aggregation. |
DataStreamReader, DataStreamWriter, StreamingQuery | Structured streaming API (Spark-style). |
QueryHandle, QueryResult | Async query execution and result collection. |
PreparedStatement | Parameterised SQL statements. |
col, lit, expr, avg, count, sum, min, max | Expression builder functions. |
Pipeline, PipelineBuilder | Source-to-sink pipeline execution. |
ValueState, MapState, ListState | Keyed operator state. |
KrishivError, Result | Error type and alias. |
RecordBatch, Schema, Field, DataType | Re-exported Arrow types. |
Quick Example
use krishiv_api::{Session, Result, col, lit};
#[tokio::main]
async fn main() -> Result<()> {
let session = Session::embedded().await?;
// SQL path
let result = session.sql("SELECT 1 + 1 AS two").await?.collect().await?;
// DataFrame path
let df = session.read_parquet("data/sales.parquet").await?
.filter(col("amount").gt(lit(100)))?
.select(&["customer_id", "amount"])?;
df.show().await?;
Ok(())
}