Skip to main content

Module docs

Module docs 

Source
Expand description

Document lookup tool module

Provides tools and services for querying Rust crate documentation.

§Submodules

  • cache: Document cache
  • html: HTML processing
  • lookup_crate: Crate documentation lookup
  • lookup_item: Item documentation lookup
  • search: Crate search

§Examples

use std::sync::Arc;
use crates_docs::tools::docs::DocService;
use crates_docs::cache::memory::MemoryCache;

let cache = Arc::new(MemoryCache::new(1000));
let service = DocService::new(cache).expect("Failed to create DocService");

Re-exports§

pub use lookup_crate::LookupCrateTool;
pub use lookup_item::LookupItemTool;
pub use search::SearchCratesTool;
pub use cache::DocCacheTtl;

Modules§

cache
Document cache module
html
HTML processing utilities
lookup_crate
Lookup crate documentation tool
lookup_item
Lookup item documentation tool
search
Search crates tool

Structs§

DocService
Document service

Enums§

Format
Output format for documentation

Constants§

DOC_FORMATS
Formats supported by the documentation lookup tools (lookup_crate, lookup_item). JSON is intentionally excluded: these tools render prose documentation, not structured data.
SEARCH_FORMATS
Formats supported by the search_crates tool. HTML is intentionally excluded: search results are structured records, not an HTML document.

Functions§

build_crates_io_search_url
Build crates.io API search URL
build_docs_all_items_url
Build the docs.rs all.html index URL for a crate.
build_docs_item_url
Build docs.rs search URL for item lookup
build_docs_item_url_candidates
Build candidate docs.rs URLs for a specific item, in priority order.
build_docs_url
Build docs.rs URL for crate documentation
crates_io_base_url
Get the crates.io base URL
docs_rs_base_url
Get the docs.rs base URL
find_item_url_in_all_html
Resolve an item page URL from a crate’s all.html index by item name.
is_rust_std_crate
Standard distribution crates documented on doc.rust-lang.org.
normalize_version
Normalize a user-supplied version string for docs.rs URL construction.
parse_format
Parse and validate a format string against the formats a tool supports.
validate_crate_name
Validate a crate name supplied by a tool caller.
validate_item_path
Validate an item path supplied by a tool caller.
validate_search_query
Validate a search query supplied by a tool caller.
validate_version
Validate an optional version string supplied by a tool caller.