Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[AI] Add rust example #26

Merged
merged 1 commit into from
Nov 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,11 @@ go_dependencies()
### Rust Setup
load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains")
rules_rust_dependencies()
rust_register_toolchains()
rust_register_toolchains(
versions=["1.78.0"],
# Specifies the Rust edition to use for the registered toolchains
edition = "2021",
)

### Docker Setup
load("@rules_oci//oci:dependencies.bzl", "rules_oci_dependencies")
Expand Down Expand Up @@ -127,8 +131,6 @@ opentelemetry_cpp_deps()
load("@io_opentelemetry_cpp//bazel:extra_deps.bzl", "opentelemetry_extra_deps")
opentelemetry_extra_deps()



load("@aspect_bazel_lib//lib:repositories.bzl", "aspect_bazel_lib_dependencies")

# aspect_bazel_lib depends on bazel_skylib
Expand Down
1 change: 1 addition & 0 deletions experimental/hello-rust/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
/target
9 changes: 9 additions & 0 deletions experimental/hello-rust/BUILD
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package(default_visibility = ["//visibility:public"])

load("@rules_rust//rust:defs.bzl", "rust_binary")

rust_binary(
name = "hello_world",
srcs = ["src/main.rs"],
deps = [],
)
10 changes: 10 additions & 0 deletions experimental/hello-rust/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
## Rust Example

### Init a project
```
cargo new hello_world
```

### References
- [bazel rust](https://bazelbuild.github.io/rules_rust/)
- [rust lang](https://doc.rust-lang.org/cargo/getting-started/first-steps.html)
3 changes: 3 additions & 0 deletions experimental/hello-rust/src/main.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
fn main() {
println!("Hello, world!");
}