Skip to content

feat: add Rust runtime example#188

Merged
moritzzimmer merged 3 commits intomainfrom
feat/rust-runtime-example
Mar 27, 2026
Merged

feat: add Rust runtime example#188
moritzzimmer merged 3 commits intomainfrom
feat/rust-runtime-example

Conversation

@moritzzimmer
Copy link
Copy Markdown
Owner

@moritzzimmer moritzzimmer commented Mar 12, 2026

Summary

  • Add Rust runtime example using provided.al2023 custom runtime with cargo-lambda for cross-compilation to ARM64
  • Uses cargo lambda new project structure with generic_handler module, consistent with official tooling
  • Handler returns system info (runtime, architecture, message) matching Go/Java/Python examples
  • Uses build.rs to embed rustc version at compile time
  • Add target/ to root .gitignore for Rust build artifacts
  • Update terraform-lambda skill with Rust runtime reference

Test plan

  • cargo test passes
  • make package builds successfully
  • terraform validate passes
  • make tf MODE=apply deploys and invokes successfully
  • Lambda accepts default console test event (any JSON payload)
  • pre-commit run -a passes

🤖 Generated with Claude Code

Copilot AI review requested due to automatic review settings March 12, 2026 10:30
@moritzzimmer moritzzimmer self-assigned this Mar 12, 2026
@moritzzimmer moritzzimmer added 📖 documentation Improvements or additions to documentation 💅 enhancement New feature or request labels Mar 12, 2026

This comment was marked as outdated.

moritzzimmer and others added 2 commits March 27, 2026 09:00
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Use cargo lambda new generated project structure with generic_handler
module, system info response (runtime, architecture) consistent with
Go/Java/Python examples, and build.rs for rustc version embedding.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@moritzzimmer moritzzimmer force-pushed the feat/rust-runtime-example branch from f3d9cbf to b4c03b7 Compare March 27, 2026 08:19
Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Copilot AI review requested due to automatic review settings March 27, 2026 08:25
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 13 out of 15 changed files in this pull request and generated 2 comments.


package: build ## Package the Lambda function as a zip
mkdir -p build
cp target/lambda/lambda-rust-example/bootstrap.zip build/lambda.zip
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The package target hardcodes the crate directory name (target/lambda/lambda-rust-example/...). This makes the example brittle when users copy it and rename the crate in Cargo.toml (the copy step will fail). Consider deriving the crate name (e.g., via cargo metadata) or copying from target/lambda/*/bootstrap.zip to keep the Makefile working after renames.

Suggested change
cp target/lambda/lambda-rust-example/bootstrap.zip build/lambda.zip
cp target/lambda/*/bootstrap.zip build/lambda.zip

Copilot uses AI. Check for mistakes.

/// This is the main body for the function.
/// Write your code inside it.
/// There are some code example in the following URLs:
Copy link

Copilot AI Mar 27, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo in comment: use plural “examples” here.

Suggested change
/// There are some code example in the following URLs:
/// There are some code examples in the following URLs:

Copilot uses AI. Check for mistakes.
@moritzzimmer moritzzimmer merged commit d0e9949 into main Mar 27, 2026
9 checks passed
@moritzzimmer moritzzimmer deleted the feat/rust-runtime-example branch March 27, 2026 08:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

📖 documentation Improvements or additions to documentation 💅 enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants