Expand description
Document lookup tool module
Provides tools and services for querying Rust crate documentation.
§Submodules
cache: Document cachehtml: HTML processinglookup_crate: Crate documentation lookuplookup_item: Item documentation lookupsearch: 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_cratestool. 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.htmlindex 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.htmlindex 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.