tree: c3aa01d339a8e645353c37b1602e13afb96a9d6f [path history] [tgz]
  1. client/
  2. server/
  3. README.md
examples/fidl/rust/services/README.md

Rust FIDL Services Example

This directory contains example code for a service.

Building

To build the components for this example, include the following in your fx set command:

--with //examples/fidl/rust/services:echo-service-rust

Then, run fx build.

Running the example

To run the example, run the echo_realm component. This creates the client and server component instances and routes the capabilities:

ffx component run /core/ffx-laboratory:echo_realm fuchsia-pkg://fuchsia.com/echo-service-rust#meta/echo_realm.cm

Then, we can start the echo_client instance:

ffx component start /core/ffx-laboratory:echo_realm/echo_client

The server component starts when the client attempts to connect to the Echo protocol. You should see the following output using fx log:

[echo_server] INFO: Received EchoString request for string "hello world!"
[echo_server] INFO: Response sent successfully
[echo_client] INFO: regular response: "hello world!"
[echo_server] INFO: Received EchoString request for string "hello world!"
[echo_server] INFO: Response sent successfully
[echo_client] INFO: reversed response: "!dlrow olleh"