Documentation
¶
Overview ¶
Package rust provides a documentation source adapter that reads Rust source code from a local checkout of any Rust crate repository. It parses raw Rust source via tree-sitter to extract structs, enums, traits, functions, type aliases, macros, and constants without making any network calls during parsing.
Index ¶
- func NewActixWebFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewAxumFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewClapFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewDieselFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewDioxusFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewGothamFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewHyperFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewLeptosFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewLocoFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewNtexFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewPavexFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewPoemFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewRayonFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewReqwestFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewRocketFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewSQLxFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewSalvoFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewSerdeFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewStdlibFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewTauriFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewTideFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewTokioFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewTracingFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewWarpFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- func NewYewFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)
- type Config
- type RustSource
- func (s *RustSource) DetectWrapper(method *source.Method) (bool, string, string)
- func (s *RustSource) DiscoverEntities(ctx context.Context, fetch source.FetchFunc) ([]string, error)
- func (s *RustSource) ID() string
- func (s *RustSource) Meta() source.LibraryMeta
- func (s *RustSource) ParseEntity(ctx context.Context, entityID string, content []byte) (*source.Entity, []string, error)
- func (s *RustSource) ParseMethod(ctx context.Context, methodID string, content []byte) (*source.Method, error)
- func (s *RustSource) ParseSourceCode(entityID string, content []byte) (string, error)
- func (s *RustSource) ResolveWrapperURL(targetName, targetKind, entitySlug string) string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewActixWebFactory ¶
NewActixWebFactory creates a Source for the Actix-web framework.
func NewAxumFactory ¶
NewAxumFactory creates a Source for the Axum web framework.
func NewClapFactory ¶
NewClapFactory creates a Source for the Clap argument parser.
func NewDieselFactory ¶
NewDieselFactory creates a Source for the Diesel ORM.
func NewDioxusFactory ¶
NewDioxusFactory creates a Source for the Dioxus cross-platform UI framework.
func NewGothamFactory ¶
NewGothamFactory creates a Source for the Gotham web framework.
func NewHyperFactory ¶
NewHyperFactory creates a Source for the Hyper HTTP library.
func NewLeptosFactory ¶
NewLeptosFactory creates a Source for the Leptos full-stack reactive framework.
func NewLocoFactory ¶
NewLocoFactory creates a Source for the Loco Rails-like framework.
func NewNtexFactory ¶
NewNtexFactory creates a Source for the Ntex composable networking services framework.
func NewPavexFactory ¶
NewPavexFactory creates a Source for the Pavex backend framework.
func NewPoemFactory ¶
NewPoemFactory creates a Source for the Poem web framework.
func NewRayonFactory ¶
NewRayonFactory creates a Source for the Rayon data parallelism library.
func NewReqwestFactory ¶
NewReqwestFactory creates a Source for the Reqwest HTTP client.
func NewRocketFactory ¶
NewRocketFactory creates a Source for the Rocket web framework.
func NewSQLxFactory ¶
NewSQLxFactory creates a Source for the SQLx async database library.
func NewSalvoFactory ¶
NewSalvoFactory creates a Source for the Salvo web framework.
func NewSerdeFactory ¶
NewSerdeFactory creates a Source for the Serde serialization library.
func NewStdlibFactory ¶
NewStdlibFactory creates a Source for the Rust standard library.
func NewTauriFactory ¶
NewTauriFactory creates a Source for the Tauri desktop app framework.
func NewTideFactory ¶
NewTideFactory creates a Source for the Tide async web framework.
func NewTokioFactory ¶
NewTokioFactory creates a Source for the Tokio async runtime.
func NewTracingFactory ¶
NewTracingFactory creates a Source for the Tracing instrumentation library.
func NewWarpFactory ¶
NewWarpFactory creates a Source for the Warp web framework.
func NewYewFactory ¶
NewYewFactory creates a Source for the Yew frontend WASM framework.
Types ¶
type Config ¶
type Config struct {
// Owner is the GitHub owner (e.g., "tokio-rs").
Owner string
// Repo is the GitHub repository name (e.g., "tokio").
Repo string
// CrateName is the crate name for display (e.g., "tokio").
CrateName string
// CratePath is the subdirectory within the repo containing the crate source.
// Empty means the repo root (e.g., "tokio" for tokio-rs/tokio monorepo).
CratePath string
// Version is the git tag/branch used for source-code links.
Version string
// Description is a human-readable crate description.
Description string
}
Config holds configuration for a Rust crate source adapter.
type RustSource ¶
type RustSource struct {
// contains filtered or unexported fields
}
RustSource is a documentation source adapter that reads Rust source code from a local checkout and parses it via tree-sitter.
func New ¶
func New(repoPath string, cfg Config) *RustSource
New constructs a new RustSource pointing at a local checkout. The index is initialised empty so that DetectWrapper and ResolveWrapperURL are safe to call before DiscoverEntities.
func (*RustSource) DetectWrapper ¶
DetectWrapper analyzes a method's source code for wrapper patterns.
func (*RustSource) DiscoverEntities ¶
func (s *RustSource) DiscoverEntities(ctx context.Context, fetch source.FetchFunc) ([]string, error)
DiscoverEntities walks the source tree and returns entity identifiers.
func (*RustSource) ID ¶
func (s *RustSource) ID() string
ID returns the canonical library ID (e.g., "rust/tokio").
func (*RustSource) Meta ¶
func (s *RustSource) Meta() source.LibraryMeta
Meta returns metadata for the library record.
func (*RustSource) ParseEntity ¶
func (s *RustSource) ParseEntity(ctx context.Context, entityID string, content []byte) (*source.Entity, []string, error)
ParseEntity parses a single entity from file content.
func (*RustSource) ParseMethod ¶
func (s *RustSource) ParseMethod(ctx context.Context, methodID string, content []byte) (*source.Method, error)
ParseMethod parses a method identified by entityID#TypeName::method_name.
func (*RustSource) ParseSourceCode ¶
func (s *RustSource) ParseSourceCode(entityID string, content []byte) (string, error)
ParseSourceCode extracts the source code for a specific entity or method.
func (*RustSource) ResolveWrapperURL ¶
func (s *RustSource) ResolveWrapperURL(targetName, targetKind, entitySlug string) string
ResolveWrapperURL constructs the identifier to fetch the wrapped target's source.