rust

package
v0.0.0-...-9ce4fc3 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 11 Imported by: 0

Documentation

Overview

Package rust provides a backend for Rust using Cargo.

Index

Constants

This section is empty.

Variables

View Source
var RustBackend = api.LanguageBackend{
	Name:             "rust",
	Specfile:         "Cargo.toml",
	Lockfile:         "Cargo.lock",
	IsAvailable:      cargoIsAvailable,
	FilenamePatterns: []string{"*.rs"},
	GetPackageDir: func() string {
		return "target"
	},
	Search: search,
	Info:   info,
	Add: func(ctx context.Context, pkgs map[api.PkgName]api.PkgSpec, projectName string) {

		span, ctx := tracer.StartSpanFromContext(ctx, "cargo add")
		defer span.Finish()
		if !util.Exists("Cargo.toml") {
			util.RunCmd([]string{"cargo", "init", "."})
		}
		cmd := []string{"cargo", "add"}
		for name, spec := range pkgs {
			arg := string(name)
			if spec != "" {
				arg += "@" + string(spec)
			}
			cmd = append(cmd, arg)
		}
		util.RunCmd(cmd)
	},
	Remove: func(ctx context.Context, pkgs map[api.PkgName]bool) {

		span, ctx := tracer.StartSpanFromContext(ctx, "cargo rm")
		defer span.Finish()
		cmd := []string{"cargo", "rm"}
		for name := range pkgs {
			cmd = append(cmd, string(name))
		}
		util.RunCmd(cmd)
	},
	Lock: func(ctx context.Context) {

	},
	Install: func(ctx context.Context) {

	},
	ListSpecfile: listSpecfile,
	ListLockfile: listLockfile,
	Guess: func(ctx context.Context) (map[string][]api.PkgName, bool) {
		util.NotImplemented()
		return nil, false
	},
	InstallReplitNixSystemDependencies: nix.DefaultInstallReplitNixSystemDependencies,
}

RustBackend is a UPM backend for Rust that uses Cargo.

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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