blob: 63c11cea5d98e7659f6ec04c1d398e096805ae7d [file] [log] [blame]
// Copyright 2019 The Fuchsia Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
/// This program hosts the `Trigger` service, which starts the component and hangs.
use {
fidl_fidl_test_components as ftest, fuchsia_async as fasync,
fuchsia_component::server::ServiceFs,
futures::{StreamExt, TryStreamExt},
};
#[fasync::run_singlethreaded]
async fn main() {
let mut fs = ServiceFs::new_local();
fs.dir("svc").add_fidl_service(move |stream| {
fasync::Task::local(async move {
run_trigger_service(stream).await;
})
.detach();
});
fs.take_and_serve_directory_handle().expect("failed to serve outgoing directory");
fs.collect::<()>().await;
}
async fn run_trigger_service(mut stream: ftest::TriggerRequestStream) {
while let Some(event) = stream.try_next().await.expect("failed to serve trigger service") {
let ftest::TriggerRequest::Run { responder } = event;
responder.send("").expect("failed to send trigger response");
}
}