rust

package
v0.1.4 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 10, 2026 License: GPL-3.0 Imports: 13 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewActixWebFactory

func NewActixWebFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewActixWebFactory creates a Source for the Actix-web framework.

func NewAxumFactory

func NewAxumFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewAxumFactory creates a Source for the Axum web framework.

func NewClapFactory

func NewClapFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewClapFactory creates a Source for the Clap argument parser.

func NewDieselFactory

func NewDieselFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewDieselFactory creates a Source for the Diesel ORM.

func NewDioxusFactory

func NewDioxusFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewDioxusFactory creates a Source for the Dioxus cross-platform UI framework.

func NewGothamFactory

func NewGothamFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewGothamFactory creates a Source for the Gotham web framework.

func NewHyperFactory

func NewHyperFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewHyperFactory creates a Source for the Hyper HTTP library.

func NewLeptosFactory

func NewLeptosFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewLeptosFactory creates a Source for the Leptos full-stack reactive framework.

func NewLocoFactory

func NewLocoFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewLocoFactory creates a Source for the Loco Rails-like framework.

func NewNtexFactory

func NewNtexFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewNtexFactory creates a Source for the Ntex composable networking services framework.

func NewPavexFactory

func NewPavexFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewPavexFactory creates a Source for the Pavex backend framework.

func NewPoemFactory

func NewPoemFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewPoemFactory creates a Source for the Poem web framework.

func NewRayonFactory

func NewRayonFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewRayonFactory creates a Source for the Rayon data parallelism library.

func NewReqwestFactory

func NewReqwestFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewReqwestFactory creates a Source for the Reqwest HTTP client.

func NewRocketFactory

func NewRocketFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewRocketFactory creates a Source for the Rocket web framework.

func NewSQLxFactory

func NewSQLxFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewSQLxFactory creates a Source for the SQLx async database library.

func NewSalvoFactory

func NewSalvoFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewSalvoFactory creates a Source for the Salvo web framework.

func NewSerdeFactory

func NewSerdeFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewSerdeFactory creates a Source for the Serde serialization library.

func NewStdlibFactory

func NewStdlibFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewStdlibFactory creates a Source for the Rust standard library.

func NewTauriFactory

func NewTauriFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewTauriFactory creates a Source for the Tauri desktop app framework.

func NewTideFactory

func NewTideFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewTideFactory creates a Source for the Tide async web framework.

func NewTokioFactory

func NewTokioFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewTokioFactory creates a Source for the Tokio async runtime.

func NewTracingFactory

func NewTracingFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewTracingFactory creates a Source for the Tracing instrumentation library.

func NewWarpFactory

func NewWarpFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

NewWarpFactory creates a Source for the Warp web framework.

func NewYewFactory

func NewYewFactory(repoPath string, opts registry.FactoryOptions) (source.Source, error)

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

func (s *RustSource) DetectWrapper(method *source.Method) (bool, string, string)

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL