feat(xatu): scaffold project
Add the Xatu Rust package as a minimal hello-world skeleton with Cargo workspace metadata and Bazel library, binary, and test targets.
This commit is contained in:
20
src/xatu/BUILD
Normal file
20
src/xatu/BUILD
Normal file
@@ -0,0 +1,20 @@
|
||||
load("@rules_rust//rust:defs.bzl", "rust_binary", "rust_library", "rust_test")
|
||||
|
||||
rust_library(
|
||||
name = "xatu_lib",
|
||||
crate_name = "xatu",
|
||||
srcs = ["lib.rs"],
|
||||
)
|
||||
|
||||
rust_binary(
|
||||
name = "xatu",
|
||||
crate_name = "xatu_cli",
|
||||
srcs = ["main.rs"],
|
||||
deps = [":xatu_lib"],
|
||||
)
|
||||
|
||||
rust_test(
|
||||
name = "lib_test",
|
||||
srcs = ["lib_test.rs"],
|
||||
deps = [":xatu_lib"],
|
||||
)
|
||||
13
src/xatu/Cargo.toml
Normal file
13
src/xatu/Cargo.toml
Normal file
@@ -0,0 +1,13 @@
|
||||
[package]
|
||||
name = "xatu"
|
||||
version = "0.1.0"
|
||||
edition = "2024"
|
||||
|
||||
[lib]
|
||||
path = "lib.rs"
|
||||
|
||||
[[bin]]
|
||||
name = "xatu"
|
||||
path = "main.rs"
|
||||
|
||||
[dependencies]
|
||||
5
src/xatu/lib.rs
Normal file
5
src/xatu/lib.rs
Normal file
@@ -0,0 +1,5 @@
|
||||
pub const GREETING: &str = "Hello from Xatu";
|
||||
|
||||
pub fn greeting() -> &'static str {
|
||||
GREETING
|
||||
}
|
||||
4
src/xatu/lib_test.rs
Normal file
4
src/xatu/lib_test.rs
Normal file
@@ -0,0 +1,4 @@
|
||||
#[test]
|
||||
fn greeting_returns_hello_message() {
|
||||
assert_eq!(xatu::greeting(), "Hello from Xatu");
|
||||
}
|
||||
3
src/xatu/main.rs
Normal file
3
src/xatu/main.rs
Normal file
@@ -0,0 +1,3 @@
|
||||
fn main() {
|
||||
println!("{}", xatu::greeting());
|
||||
}
|
||||
Reference in New Issue
Block a user