ua-client 0.9.0

Native OPC UA browser/inspector GUI built on async-opcua and egui
Documentation
use std::process::ExitCode;

use tokio::runtime::Runtime;
use tokio::sync::mpsc;

use ua_client::engine::Engine;
use ua_client::logger;
use ua_client::tui;
use ua_client::tui::args::{ParseOutcome, parse};

fn main() -> ExitCode {
    let args = match parse(std::env::args()) {
        ParseOutcome::Run(a) => a,
        ParseOutcome::Exit(code) => return code,
    };

    let (log_tx, log_rx) = mpsc::unbounded_channel();
    logger::init_tracing(log_tx);

    let rt = match Runtime::new() {
        Ok(r) => r,
        Err(e) => {
            eprintln!("ua-tui: failed to build tokio runtime: {e}");
            return ExitCode::FAILURE;
        }
    };
    let (engine, update_rx) = Engine::new(rt, log_rx);
    if let Err(e) = tui::run(engine, update_rx, args) {
        eprintln!("ua-tui: {e}");
        return ExitCode::FAILURE;
    }
    ExitCode::SUCCESS
}