diff --git a/Cargo.toml b/Cargo.toml index d51a591..7ca828e 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -26,7 +26,7 @@ tonic = "0.12.3" tonic-build = "0.12.3" [workspace.package] -version = "0.16.0" +version = "0.16.2" authors = [ "Mike Nguyen ", "The Dapr Authors " diff --git a/README.md b/README.md index 6ab00b2..e1a77e9 100644 --- a/README.md +++ b/README.md @@ -53,7 +53,7 @@ Add the following to your `Cargo.toml` file: ```toml [dependencies] -dapr = "0.16.0" +dapr = "0.16" ``` Here's a basic example to create a client: @@ -95,7 +95,7 @@ To fetch the latest .proto files from Dapr execute the script `update-protos.sh` By default, the script fetches the latest proto updates from the master branch of the Dapr repository. If you need to choose a specific release or version, use the -v flag: ```bash -./update-protos.sh -v v1.14.0 +./update-protos.sh -v v1.15.0 ``` You will also need to install [protoc](https://github.com/protocolbuffers/protobuf#protobuf-compiler-installation). diff --git a/daprdocs/content/en/rust-sdk-docs/rust-client/_index.md b/daprdocs/content/en/rust-sdk-docs/rust-client/_index.md index 017d0b7..b54449d 100644 --- a/daprdocs/content/en/rust-sdk-docs/rust-client/_index.md +++ b/daprdocs/content/en/rust-sdk-docs/rust-client/_index.md @@ -27,8 +27,7 @@ Add Dapr to your `cargo.toml` ```toml [dependencies] -# Other dependencies -dapr = "0.16.0" +dapr = "0.16" ``` You can either reference `dapr::Client` or bind the full path to a new name as follows: diff --git a/examples/src/docker-compose-metadata-example/Cargo.toml b/examples/src/docker-compose-metadata-example/Cargo.toml new file mode 100644 index 0000000..cecb81c --- /dev/null +++ b/examples/src/docker-compose-metadata-example/Cargo.toml @@ -0,0 +1,15 @@ +[package] +name = "metadata" +publish = false +version = "0.0.1" +edition = "2018" + +[workspace] + +[dependencies] +dapr = "0.16.0-rc.6" +tokio = { version = "1.43", features = ["full"] } + +[[bin]] +name = "metadata" +path = "main.rs" \ No newline at end of file diff --git a/examples/src/docker-compose-metadata-example/Dockerfile b/examples/src/docker-compose-metadata-example/Dockerfile new file mode 100644 index 0000000..9fd65ac --- /dev/null +++ b/examples/src/docker-compose-metadata-example/Dockerfile @@ -0,0 +1,5 @@ +FROM rust:1.84.1 +WORKDIR /app +COPY . . +RUN cargo build --release +CMD ["./target/release/metadata"] \ No newline at end of file diff --git a/examples/src/docker-compose-metadata-example/docker-compose.yml b/examples/src/docker-compose-metadata-example/docker-compose.yml new file mode 100644 index 0000000..f490bd3 --- /dev/null +++ b/examples/src/docker-compose-metadata-example/docker-compose.yml @@ -0,0 +1,34 @@ +version: '3' +services: + ############################ + # Rustapp app + Dapr sidecar + ############################ + rustapp: + build: . + ports: + - "50002:50002" + depends_on: + - placement + networks: + - hello-dapr + rustapp-dapr: + image: "daprio/daprd:edge" + command: ["./daprd", + "-app-id", "rustapp", + "-placement-host-address", "placement:50006", + "-dapr-grpc-port", "50002"] + depends_on: + - rustapp + network_mode: "service:rustapp" + ############################ + # Dapr placement service + ############################ + placement: + image: "daprio/dapr:edge" + command: ["./placement", "-port", "50006"] + ports: + - "50006:50006" + networks: + - hello-dapr +networks: + hello-dapr: \ No newline at end of file diff --git a/examples/src/docker-compose-metadata-example/main.rs b/examples/src/docker-compose-metadata-example/main.rs new file mode 100644 index 0000000..3a6d417 --- /dev/null +++ b/examples/src/docker-compose-metadata-example/main.rs @@ -0,0 +1,20 @@ +use std::time::Duration; + +type DaprClient = dapr::Client; + +#[tokio::main] +async fn main() -> Result<(), Box> { + // Sleep to allow for the server to become available + tokio::time::sleep(Duration::from_secs(5)).await; + + let address = "https://127.0.0.1".to_string(); + let port = "50002".to_string(); + + let mut client = DaprClient::connect_with_port(address, port).await?; + + let metadata = client.get_metadata().await?; + + println!("retrieved data: {:?}", metadata); + + Ok(()) +}