#![allow(
clippy::todo,
clippy::unimplemented,
clippy::panic,
clippy::unwrap_used,
clippy::expect_used,
clippy::missing_errors_doc,
clippy::missing_panics_doc,
clippy::doc_markdown,
clippy::needless_pass_by_value,
clippy::too_many_arguments,
clippy::unused_async,
clippy::diverging_sub_expression,
clippy::no_effect_underscore_binding,
clippy::let_unit_value,
clippy::used_underscore_binding,
clippy::let_underscore_untyped,
clippy::struct_field_names,
clippy::manual_let_else,
clippy::map_unwrap_or,
clippy::redundant_pub_crate,
clippy::cast_precision_loss,
clippy::cast_possible_truncation,
clippy::cast_sign_loss,
dead_code,
unreachable_code,
unused_assignments,
unused_mut,
unused_imports,
unused_variables
)]
use arcp::error::ARCPError;
use arcp::transport::MemoryTransport;
use arcp::ARCPClient;
use serde_json::json;
type Client = ARCPClient<MemoryTransport>;
const BAR_WIDTH: usize = 30;
fn render_bar(current: u64, total: u64) -> String {
let ratio = if total == 0 {
0.0_f64
} else {
(current as f64 / total as f64).min(1.0)
};
let filled = (BAR_WIDTH as f64 * ratio).round() as usize;
let empty = BAR_WIDTH - filled;
format!(
"[{}{}] {}/{}",
"#".repeat(filled),
".".repeat(empty),
current,
total,
)
}
async fn submit_indexer(_client: &Client) -> Result<String, ARCPError> {
todo!()
}
async fn stream_progress(
_client: &Client,
_job_id: &str,
) -> Result<(serde_json::Value, u32), ARCPError> {
let mut updates: u32 = 0;
todo!()
}
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let client: Client = todo!();
let job_id = submit_indexer(&client).await?;
println!("accepted: job_id={job_id}");
let (result, updates) = stream_progress(&client, &job_id).await?;
println!();
println!("result: {result} progress-updates={updates}");
Ok(())
}