pub const GUID_SIZE: usize = 16;
pub const MAX_INBOX_SIZE: usize = 1 << 27;
pub const MAX_OUTBOX_SIZE: usize = 1 << 27;
mod error;
mod mpid_header;
mod mpid_message;
mod mpid_message_wrapper;
pub use self::error::Error;
pub use self::mpid_message_wrapper::MpidMessageWrapper;
pub use self::mpid_message::{MpidMessage, MAX_BODY_SIZE};
pub use self::mpid_header::{MpidHeader, MAX_HEADER_METADATA_SIZE};
use std::fmt::Write;
fn format_binary_array<V: AsRef<[u8]>>(input: V) -> String {
let input_ref = input.as_ref();
if input_ref.len() <= 6 {
let mut ret = String::new();
for byte in input_ref.iter() {
unwrap_result!(write!(ret, "{:02x}", byte));
}
return ret;
}
format!("{:02x}{:02x}{:02x}..{:02x}{:02x}{:02x}",
input_ref[0],
input_ref[1],
input_ref[2],
input_ref[input_ref.len() - 3],
input_ref[input_ref.len() - 2],
input_ref[input_ref.len() - 1])
}
#[cfg(test)]
fn generate_random_bytes(size: usize) -> Vec<u8> {
use rand;
use rand::Rng;
rand::thread_rng().gen_iter().take(size).collect()
}