rust

package
v0.1.0 Latest Latest
Warning

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

Go to latest
Published: May 7, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

Package rust implements the Rust import extractor.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func DepKey

func DepKey(crate string) string

DepKey returns the crate name for a Rust import path.

"serde"          -> "serde"
"serde::Deserialize" already gets parsed down to "serde" upstream
"crate::foo"     -> ""    (own crate)
"super::foo"     -> ""    (relative)
"self::foo"      -> ""    (relative)
"std::io"        -> ""    (stdlib)
"core::mem"      -> ""    (stdlib)
"alloc::vec"     -> ""    (stdlib)

Cargo crate names use dashes; Rust import paths use underscores (cargo's --bin auto-renames). depusage stores the underscored form it sees in source. Consumers that want to compare against Cargo.toml dep names can s/_/-/g.

func Extract

func Extract(body []byte, opts extract.Options) (extract.Result, error)

Extract runs the Rust import pass over body.

func IsRelative

func IsRelative(crate string) bool

IsRelative reports whether the leading-path-segment refers to project-local code rather than an external crate.

Types

This section is empty.

Jump to

Keyboard shortcuts

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