Skip to content

Commit

Permalink
[AI] Add rust example
Browse files Browse the repository at this point in the history
  • Loading branch information
lshmouse committed Nov 11, 2024
1 parent a708081 commit b120cb3
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 3 deletions.
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 = [],
)
9 changes: 9 additions & 0 deletions experimental/hello-rust/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
## Rust Example

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

### References
- 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!");
}

0 comments on commit b120cb3

Please sign in to comment.