blob: c1225dfe223cf46de6fd44a31108e09aadaed126 [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 {
anyhow::{Context as _, Error},
fuchsia_async as fasync,
use crate::{
service::{ManagerService, RegistryService},
mod input2_service;
mod registry;
mod router;
mod service;
const SERVER_THREADS: usize = 2;
/// Environment consists of FIDL services handlers and shortcut storage.
pub struct Environment {
store: RegistryStore,
input2_service: Arc<Mutex<Input2Service>>,
registry_service: RegistryService,
manager_service: Arc<Mutex<ManagerService>>,
impl Environment {
fn new() -> Self {
let store = RegistryStore::new();
Environment {
store: store.clone(),
input2_service: Arc::new(Mutex::new(Input2Service::new(store.clone()))),
registry_service: RegistryService::new(),
manager_service: Arc::new(Mutex::new(ManagerService::new(store))),
async fn run() -> Result<(), Error> {
let environment = Environment::new();
let router = Router::new(environment);
fn main() -> Result<(), Error> {
fuchsia_syslog::init_with_tags(&["shortcut"]).expect("shortcut syslog init should not fail");
let mut executor =
fasync::Executor::new().context("Creating fuchsia_async executor for Shortcut failed")?;, SERVER_THREADS)