use rerun::external::{re_crash_handler, re_grpc_server, re_log, re_memory, re_viewer, tokio};
mod color_archetype;
mod color_coordinates_view;
mod color_coordinates_visualizer_system;
#[global_allocator]
static GLOBAL: re_memory::AccountingAllocator<mimalloc::MiMalloc> =
re_memory::AccountingAllocator::new(mimalloc::MiMalloc);
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let main_thread_token = rerun::MainThreadToken::i_promise_i_am_on_the_main_thread();
re_log::setup_logging();
re_crash_handler::install_crash_handlers(re_viewer::build_info());
let (rx, _) = re_grpc_server::spawn_with_recv(
"0.0.0.0:9876".parse()?,
"75%".parse()?,
re_grpc_server::shutdown::never(),
);
let startup_options = re_viewer::StartupOptions::default();
let app_env = re_viewer::AppEnvironment::Custom("My extended Rerun Viewer".to_owned());
println!(
"This example starts a custom Rerun Viewer that is ready to accept data… you have to give it some!"
);
println!("Try for example to run: `cargo run -p minimal_options -- --connect` in another terminal instance.");
re_viewer::run_native_app(
main_thread_token,
Box::new(move |cc| {
let mut app = re_viewer::App::new(
main_thread_token,
re_viewer::build_info(),
&app_env,
startup_options,
cc,
re_viewer::AsyncRuntimeHandle::from_current_tokio_runtime_or_wasmbindgen().expect(
"Could not get a runtime handle from the current Tokio runtime or Wasm bindgen.",
),
);
app.add_log_receiver(rx);
app.view_class_registry()
.add_class::<color_coordinates_view::ColorCoordinatesView>()
.unwrap();
Box::new(app)
}),
None,
)?;
Ok(())
}