Rust API Map
Use generated assist targets and the generated crate's AGENTS.md before
writing Rust queries. Generated entity and request files explicitly direct
agents to the assist target; do not guess methods or treat another model's API
as transferable.
cargo teaql --input modeling/MODEL.xml rust-assist-query/demo_sys
Replace demo_sys with the generated entity identifier listed by the current
workspace instructions.
| Need | Primary API | Where to inspect | Application use |
|---|---|---|---|
| Start a typed query | Generated Q facade | Assist output and generated q.rs | Yes; preferred entry point. |
| Filter, select, order, paginate, or enhance | Generated <Entity>Request | Assist output; request source only when needed for diagnosis | Yes; use emitted methods. |
| Make a query executable | Generated purpose(...) → PurposedQuery<T> | Generated request and q.rs | Yes; use comment → purpose → execution. |
| Execute a typed read | execute_for_list, execute_for_one, execute_for_first, execute_for_page, execute_for_exists | PurposedQuery<<Entity>Request> implementation | Yes. |
| Execute records/count/stream | execute_for_records, execute_for_record, execute_for_count, execute_for_stream | Same purposed-query implementation | Yes when the generated method is present. |
| Read or change fields | Generated accessors and update_xxx(...) methods | Assist output and generated entity API | Yes; exact names are generated. |
| Persist a graph | audit_as(...) plus AuditedSave::save(...) | Generated request support and entity implementation | Yes; audit intent is mandatory. |
| Construct the runtime | service_runtime_from_env, service_runtime, service_runtime_from_pool | Generated runtime.rs | Supported application entry points. |
| Supply repositories | TeaqlRepositoryProvider and generated repository accessors | Generated request_support.rs | Supported integration boundary. |
| Configure audit/schema | teaql_tool_core::audit_config_from_env(...) | Generated runtime.rs and environment reference | Startup integration boundary. |
| Replace data-service behavior | teaql-data-service executor traits and provider extensions | Runtime/provider crates | Advanced infrastructure boundary. |
| Edit generated entity/request/runtime files | Generated crate internals | Generated output | No; change the model or generator and regenerate. |
Query Shape
let users = Q::user_info()
.with_name_containing("Ada")
.comment("Filter users by display name")
.purpose("Render the user directory")
.execute_for_list(&ctx)
.await?;
The concrete facade, filter, selection, and terminal methods vary with the
model and generator. In the verified generated workspace, terminal methods are
implemented only on PurposedQuery<<Entity>Request>, so an unpurposed request
does not expose them.
Mutation Shape
use demo_service_core::AuditedSave as _;
user.update_name("Ada Lovelace");
user.audit_as("Correct the user's display name")
.save(&ctx)
.await?;
Inspect assist output for the exact update method and required trait import. Do not call the generated entity's internal save path directly.
Generated, Runtime, and Handwritten Boundaries
- Generated:
Q, entities, requests, expressions, checkers, repository-provider traits, runtime assembly, and sample data. Regenerate instead of editing. - Runtime: entity graph, request/value model, data-service traits, provider implementations, audit configuration, and context resources.
- Handwritten: application orchestration, behaviors outside generated files, provider selection/configuration, and tests using public generated APIs.
The verified Rust Golden Path generated both rust-lib-core and
rust-app-console, compiled and tested them, started SQLite, executed an
intent-declared query and audited mutation, then regenerated after a model
change. The generated sample_data.rs still contains two query calls without
comment; that is a generator-template defect, not a pattern to copy.