blob: 313665f81fd1ddf920c56d2ab263103272d2d727 [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.
use {
failure::{format_err, Error, ResultExt},
fidl_fuchsia_session::{ElementManagerMarker, ElementSpec},
fuchsia_async as fasync,
fuchsia_component::client::connect_to_service,
};
#[fasync::run_singlethreaded]
async fn main() -> Result<(), Error> {
let element_manager = connect_to_service::<ElementManagerMarker>()
.context("Could not connect to element manager service.")?;
element_manager
.propose_element(ElementSpec {
component_url: Some(
"fuchsia-pkg://fuchsia.com/simple_element#meta/simple_element.cm".to_string(),
),
})
.await?
.map_err(|_| format_err!("Error sending ProposeElement message"))?;
Ok(())
}