rust

package
v0.8.0 Latest Latest
Warning

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

Go to latest
Published: Jan 20, 2026 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Overview

Package rust provides Rust specific functionality for librarian.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BumpVersions

func BumpVersions(ctx context.Context, config *config.Release) error

BumpVersions finds all the crates that need a version bump and performs the bump, changing both the Cargo.toml and sidekick.toml files.

func Create

func Create(ctx context.Context, outputDir string, generateFn func(context.Context) error) error

Create creates a cargo workspace, runs the provided generation function, and validates the library.

TODO(https://github.com/googleapis/librarian/issues/3219): generateFn can be removed once sidekick.rustGenerate is deprecated.

func DefaultOutput

func DefaultOutput(channel, defaultOutput string) string

DefaultOutput derives an output path from a channel path and default output. For example: google/cloud/secretmanager/v1 with default src/generated/ returns src/generated/cloud/secretmanager/v1.

func DeriveChannelPath

func DeriveChannelPath(name string) string

DeriveChannelPath derives a channel path from a library name. For example: google-cloud-secretmanager-v1 -> google/cloud/secretmanager/v1.

func Format

func Format(ctx context.Context, library *config.Library) error

Format formats a generated Rust library. Must be called sequentially; parallel calls cause race conditions as cargo fmt runs cargo metadata, which competes for locks on the workspace Cargo.toml and Cargo.lock.

func Generate

func Generate(ctx context.Context, library *config.Library, sources *Sources) error

Generate generates a Rust client library.

func Keep

func Keep(library *config.Library) ([]string, error)

Keep returns the list of files to preserve when cleaning the output directory.

func ManifestVersionNeedsBump

func ManifestVersionNeedsBump(gitExe, lastTag, manifest string) (bool, error)

ManifestVersionNeedsBump checks if the manifest version needs to be bumped. It returns false if the version has already been updated since the last tag.

func Publish

func Publish(ctx context.Context, config *config.Release, dryRun, dryRunKeepGoing, skipSemverChecks bool) error

Publish finds all the crates that should be published. It can optionally run in dry-run mode, dry-run mode with continue on errors, and/or skip semver checks.

func ReleaseLibrary

func ReleaseLibrary(library *config.Library, version string) error

ReleaseLibrary bumps version for Cargo.toml files and updates librarian config version.

func ToConfigRelease

func ToConfigRelease(cfg *sidekickconfig.Release) *config.Release

ToConfigRelease translates a sidekick Release config to a librarian Release config.

func ToConfigTools

func ToConfigTools(sidekickTools []sidekickconfig.Tool) []config.Tool

ToConfigTools converts a slice of sidekick tools to a slice of librarian tools.

Types

type Cargo

type Cargo struct {
	Package *CrateInfo `toml:"package"`
}

Cargo is a wrapper for CrateInfo for parsing Cargo.toml files.

type CrateInfo

type CrateInfo struct {
	Name    string `toml:"name"`
	Version string `toml:"version"`
	Publish bool   `toml:"publish"`
}

CrateInfo contains the package information.

type Sources

type Sources struct {
	Conformance string
	Discovery   string
	Googleapis  string
	ProtobufSrc string
	Showcase    string
}

Sources contains the directory paths for source repositories used by sidekick.

Jump to

Keyboard shortcuts

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