32 lines
702 B
Rust
32 lines
702 B
Rust
use std::fmt::Debug;
|
|
use std::sync::{Mutex, MutexGuard};
|
|
|
|
pub use aes_gcm;
|
|
pub use env_logger;
|
|
pub use log;
|
|
pub use sp_client;
|
|
|
|
pub mod crypto;
|
|
pub mod device;
|
|
pub mod error;
|
|
pub mod network;
|
|
pub mod pcd;
|
|
pub mod prd;
|
|
pub mod process;
|
|
pub mod secrets;
|
|
pub mod signature;
|
|
pub mod silentpayments;
|
|
|
|
pub const MAX_PRD_PAYLOAD_SIZE: usize = u16::MAX as usize; // 64KiB sounds reasonable for now
|
|
|
|
pub trait MutexExt<T> {
|
|
fn lock_anyhow(&self) -> Result<MutexGuard<T>, anyhow::Error>;
|
|
}
|
|
|
|
impl<T: Debug> MutexExt<T> for Mutex<T> {
|
|
fn lock_anyhow(&self) -> Result<MutexGuard<T>, anyhow::Error> {
|
|
self.lock()
|
|
.map_err(|e| anyhow::Error::msg(format!("Failed to lock: {}", e)))
|
|
}
|
|
}
|