-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(forge): Add enum string representation support.
- Loading branch information
Showing
3 changed files
with
48 additions
and
0 deletions.
There are no files selected for viewing
20 changes: 20 additions & 0 deletions
20
crates/weaver_forge/codegen_examples/templates/registry/rust/README.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Semantic Conventions for Rust | ||
|
||
# Usage | ||
|
||
```rust | ||
fn main() { | ||
// Display the KeyValue of the attribute CLIENT_ADDRESS initialized with the value "145.34.23.56" | ||
println!("{:?}", semconv::client::CLIENT_ADDRESS.value("145.34.23.56".into())); | ||
// Display the key of the attribute CLIENT_ADDRESS | ||
println!("{:?}", semconv::client::CLIENT_ADDRESS.key()); | ||
|
||
// Display the KeyValue of the attribute CLIENT_PORT initialized with the value 8080 | ||
println!("{:?}", semconv::client::CLIENT_PORT.value(8080)); | ||
// Display the key of the attribute CLIENT_PORT | ||
println!("{:?}", semconv::client::CLIENT_PORT.key()); | ||
|
||
// Display the string representation of the enum variant HttpRequestMethod::Connect | ||
println!("{}", semconv::http::HttpRequestMethod::Connect); | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters