Expand description
§tokmd-core
Tier 4 (Library Facade)
This crate is the primary library interface for tokmd.
It coordinates scanning, aggregation, and modeling to produce code inventory receipts.
If you are embedding tokmd into another Rust application, depend on this crate
and tokmd-types. Avoid depending on tokmd-scan or tokmd-model directly unless necessary.
§What belongs here
- High-level workflow coordination
- Simplified API for library consumers
- Re-exports for convenience
- FFI-friendly JSON entrypoint
§What does NOT belong here
- CLI argument parsing (use tokmd crate)
- Low-level scanning logic (use tokmd-scan)
- Aggregation details (use tokmd-model)
§Example
use tokmd_core::{lang_workflow, settings::{ScanSettings, LangSettings}};
// Configure scan
let scan = ScanSettings::current_dir();
let lang = LangSettings {
top: 10,
files: true,
..Default::default()
};
// Run pipeline
let receipt = lang_workflow(&scan, &lang).expect("Scan failed");
assert!(receipt.report.rows.len() > 0);§JSON API (for bindings)
use tokmd_core::ffi::run_json;
let result = run_json("lang", r#"{"paths": ["."], "top": 10}"#);
let parsed: serde_json::Value = serde_json::from_str(&result).unwrap();
assert_eq!(parsed["ok"], true);Re-exports§
pub use tokmd_config as config;pub use tokmd_types as types;
Modules§
- error
- Structured error types for binding-friendly API.
- ffi
- FFI-friendly JSON entrypoint for language bindings.
- settings
- Pure settings types for binding-friendly API.
Structs§
- InMemory
File - A single logical file supplied from memory rather than the host filesystem.
Constants§
- CORE_
SCHEMA_ VERSION - Re-export schema version for bindings.
Functions§
- diff_
workflow - Runs the diff workflow comparing two receipts or paths.
- export_
workflow - Runs the export workflow with pure settings types.
- export_
workflow_ from_ inputs - Runs the file export workflow for ordered in-memory inputs.
- lang_
workflow - Runs the language summary workflow with pure settings types.
- lang_
workflow_ from_ inputs - Runs the language summary workflow for ordered in-memory inputs.
- module_
workflow - Runs the module summary workflow with pure settings types.
- module_
workflow_ from_ inputs - Runs the module summary workflow for ordered in-memory inputs.
- scan_
workflow - Runs the complete scan workflow: Scan -> Model -> Receipt.
- version
- Get the current tokmd version.