rust
A swiss army knife of functions for working with Rust projects.
Installation
dagger install github.com/purpleclay/daggerverse/rust@v0.3.0Entrypoint
Return Type
Rust !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| base | Container | - | a custom base image containing an installation of rust. If no image is provided the `rust:<LATEST_TAG>-alpine3.20` will be used. The default image will use musl to support static compilation of Rust binaries. It comes bundled with the following packages: `cmake`, `build-base`, `libressl-dev`, `musl-dev`, `perl`, and `pkgconfig` |
| src | Directory ! | - | a path to a directory containing the projects source code |
Example
dagger -m github.com/purpleclay/daggerverse/rust@225932120f3b39fcb8118c9aeb2e31f3c1b2d3f2 call \
--src DIR_PATHfunc (m *MyModule) Example(src *dagger.Directory) *dagger.Rust {
return dag.
Rust(src)
}@function
def example(src: dagger.Directory) -> dagger.Rust:
return (
dag.rust(src)
)@func()
example(src: Directory): Rust {
return dag
.rust(src)
}Types
Rust 🔗
Rust dagger module
clippy() 🔗
Lint your Rust project with Clippy to detect common mistakes and to improve your Rust code
Return Type
String !Arguments
| Name | Type | Default Value | Description |
|---|---|---|---|
| noDeps | Boolean | - | run clippy on the current crate only and not against its dependencies |
Example
dagger -m github.com/purpleclay/daggerverse/rust@225932120f3b39fcb8118c9aeb2e31f3c1b2d3f2 call \
--src DIR_PATH clippyfunc (m *MyModule) Example(ctx context.Context, src *dagger.Directory) string {
return dag.
Rust(src).
Clippy(ctx)
}@function
async def example(src: dagger.Directory) -> str:
return await (
dag.rust(src)
.clippy()
)@func()
async example(src: Directory): Promise<string> {
return dag
.rust(src)
.clippy()
}format() 🔗
Format the code in your Rust project using Rustfmt
Return Type
Directory ! Example
dagger -m github.com/purpleclay/daggerverse/rust@225932120f3b39fcb8118c9aeb2e31f3c1b2d3f2 call \
--src DIR_PATH formatfunc (m *MyModule) Example(src *dagger.Directory) *dagger.Directory {
return dag.
Rust(src).
Format()
}@function
def example(src: dagger.Directory) -> dagger.Directory:
return (
dag.rust(src)
.format()
)@func()
example(src: Directory): Directory {
return dag
.rust(src)
.format()
}formatCheck() 🔗
Checks the format of the code in your Rust project using Rustfmt. Fails if any formatting issues are detected
Return Type
String ! Example
dagger -m github.com/purpleclay/daggerverse/rust@225932120f3b39fcb8118c9aeb2e31f3c1b2d3f2 call \
--src DIR_PATH format-checkfunc (m *MyModule) Example(ctx context.Context, src *dagger.Directory) string {
return dag.
Rust(src).
FormatCheck(ctx)
}@function
async def example(src: dagger.Directory) -> str:
return await (
dag.rust(src)
.format_check()
)@func()
async example(src: Directory): Promise<string> {
return dag
.rust(src)
.formatCheck()
}audit() 🔗
Checks the security of the code in your Rust project using cargo-audit. Fails if any security issues are detected
Return Type
String ! Example
dagger -m github.com/purpleclay/daggerverse/rust@225932120f3b39fcb8118c9aeb2e31f3c1b2d3f2 call \
--src DIR_PATH auditfunc (m *MyModule) Example(ctx context.Context, src *dagger.Directory) string {
return dag.
Rust(src).
Audit(ctx)
}@function
async def example(src: dagger.Directory) -> str:
return await (
dag.rust(src)
.audit()
)@func()
async example(src: Directory): Promise<string> {
return dag
.rust(src)
.audit()
}