Skip to main content

vidya/
lib.rs

1//! Vidya — programming reference library and queryable corpus
2//!
3//! **Vidya** (Sanskrit: विद्या — knowledge, learning) provides a curated,
4//! tested, multi-language programming reference. Every concept includes
5//! best practices, instructional documentation, and reference implementations
6//! in multiple languages — all verified by CI.
7//!
8//! # Architecture
9//!
10//! Vidya has two layers:
11//!
12//! 1. **Content directory** (`content/`) — Markdown docs and source files.
13//!    No compilation needed. Humans can read it directly. AI models can
14//!    train on it. The files ARE the corpus.
15//!
16//! 2. **Rust crate** (this) — Queryable interface over the content.
17//!    Types, search, comparison, and validation. `cargo doc` generates
18//!    a browsable programming reference. MCP tools make it queryable
19//!    by agents.
20//!
21//! # Modules
22//!
23//! - [`concept`] — Core types: `Concept`, `Topic`, `Example`, `BestPractice`
24//! - [`language`] — Supported languages and their metadata
25//! - [`registry`] — In-memory concept registry, loaded from content directory
26//! - [`loader`] — Content directory loader (TOML → Registry)
27//! - [`search`] — Full-text and tag-based search across concepts
28//! - [`compare`] — Side-by-side cross-language comparison
29//! - [`validate`] — Compile/run verification of examples
30//! - [`error`] — Error types
31//!
32//! # Example
33//!
34//! ```rust
35//! use vidya::{Language, Registry};
36//!
37//! let registry = Registry::new();
38//! // Look up string handling in Rust
39//! if let Some(concept) = registry.get("strings") {
40//!     println!("{}", concept.description);
41//!     if let Some(example) = concept.example(Language::Rust) {
42//!         println!("{}", example.code);
43//!     }
44//! }
45//! ```
46
47pub mod compare;
48pub mod concept;
49pub mod error;
50pub mod language;
51pub mod loader;
52pub mod registry;
53pub mod search;
54pub mod validate;
55
56#[cfg(feature = "logging")]
57pub mod logging;
58
59#[cfg(feature = "mcp")]
60pub mod mcp;
61
62// ── Core types ─────────────────────────────────────────────────────────────
63pub use concept::{BestPractice, Concept, Example, Gotcha, PerformanceNote, Topic};
64pub use error::{Result, VidyaError};
65pub use language::Language;
66pub use registry::Registry;
67
68// ── Operations ─────────────────────────────────────────────────────────────
69pub use compare::Comparison;
70pub use search::{SearchQuery, SearchResult};
71pub use validate::ValidationResult;