Skip to main content

Module api

Module api 

Source
Expand description

The public API. One type to learn, and a return type that makes refusal impossible to ignore.

use steeldb::SteelDb;

let db = SteelDb::ingest(["Morty Shade defeated Wallace Gale at Ecruteak City in 2025."])?;

match db.query("(and defeated/* (not state/negated))") {
    Ok(answer)  => println!("{} situations", answer.len()),
    Err(refused) => println!("{refused}"),   // names what the data *does* contain
}

§Why query returns a Result

Most engines answer everything. Ask for something absent and you get an empty list, which is indistinguishable from “there are genuinely none” — and for an automated caller, indistinguishable from a correct answer. The whole argument of this engine is that it can say no, so the API makes that outcome a separate branch you have to look at rather than a value you can skim past.

Refused carries what does exist, so a caller — human or agent — can repair the question instead of guessing again.

Structs§

Answer
A complete set of matching situations.
Category
One discovered category and the words it claims.
Interval
The evidential bound on a claim: [belief, plausibility].
Options
How to build the vocabulary. The defaults are tuned for prose and rarely need changing.
Refused
A query the data cannot answer, and what it can answer instead.
SteelDb
An indexed corpus you can ask questions of.

Enums§

Error
Setup failures, kept separate from query refusals.