Skip to main content

Crate vidya

Crate vidya 

Source
Expand description

Vidya — programming reference library and queryable corpus

Vidya (Sanskrit: विद्या — knowledge, learning) provides a curated, tested, multi-language programming reference. Every concept includes best practices, instructional documentation, and reference implementations in multiple languages — all verified by CI.

§Architecture

Vidya has two layers:

  1. Content directory (content/) — Markdown docs and source files. No compilation needed. Humans can read it directly. AI models can train on it. The files ARE the corpus.

  2. Rust crate (this) — Queryable interface over the content. Types, search, comparison, and validation. cargo doc generates a browsable programming reference. MCP tools make it queryable by agents.

§Modules

  • concept — Core types: Concept, Topic, Example, BestPractice
  • language — Supported languages and their metadata
  • registry — In-memory concept registry, loaded from content directory
  • loader — Content directory loader (TOML → Registry)
  • search — Full-text and tag-based search across concepts
  • compare — Side-by-side cross-language comparison
  • validate — Compile/run verification of examples
  • error — Error types

§Example

use vidya::{Language, Registry};

let registry = Registry::new();
// Look up string handling in Rust
if let Some(concept) = registry.get("strings") {
    println!("{}", concept.description);
    if let Some(example) = concept.example(Language::Rust) {
        println!("{}", example.code);
    }
}

Re-exports§

pub use concept::BestPractice;
pub use concept::Concept;
pub use concept::Example;
pub use concept::Gotcha;
pub use concept::PerformanceNote;
pub use concept::Topic;
pub use error::Result;
pub use error::VidyaError;
pub use language::Language;
pub use registry::Registry;
pub use compare::Comparison;
pub use search::SearchQuery;
pub use search::SearchResult;
pub use validate::ValidationResult;

Modules§

compare
Side-by-side cross-language comparison.
concept
Core types for programming concepts.
error
Error types for vidya.
language
Supported programming languages and their metadata.
loader
Content loader — reads content/ directory into a populated Registry.
registry
In-memory concept registry.
search
Full-text and tag-based search across concepts.
validate
Example validation — compile/run verification.