| Crates.io | runar_common |
| lib.rs | runar_common |
| version | 0.1.0 |
| created_at | 2025-08-14 10:42:07.690697+00 |
| updated_at | 2025-08-14 10:42:07.690697+00 |
| description | Common traits and utilities for the Runar framework |
| homepage | https://github.com/runar-labs/runar-rust |
| repository | https://github.com/runar-labs/runar-rust |
| max_upload_size | |
| id | 1794727 |
| size | 47,512 |
Common traits and utilities shared across the Runar stack.
anyhow and thiserror)Add to your Cargo.toml:
[dependencies]
runar_common = "0.1"
use runar_common::logging::{Component, Logger};
let root = Logger::new_root(Component::Node, "node-123");
let svc = root.with_component(Component::Service);
svc.info("service started");
svc.warn("doing work");
svc.error("something went wrong");
use runar_common::compact_ids::compact_id;
let public_key_bytes: [u8; 65] = [0u8; 65];
let id = compact_id(&public_key_bytes);
assert_eq!(id.len(), 26);
assert!(id.chars().all(|c| c.is_ascii_lowercase() || c.is_ascii_digit()));
use runar_common::errors::{Result, anyhow};
fn do_work() -> Result<()> {
// ...
Err(anyhow!("failure"))
}
MIT. See LICENSE.