extern crate febug;
use febug::StaticWrappable;
use std::time::Duration;
use std::any::TypeId;
use std::io::Write;
use std::thread;
fn main() {
febug::start();
if febug::install_handler() {
febug::FORMATTERS.lock().unwrap().insert(TypeId::of::<String>(), |of, vid| {
let data = unsafe { &*(vid as *const String) };
let _ = of.write_all(data.as_bytes());
let _ = of.write_all(b"\n");
});
}
let threads = (0..10)
.map(|i| {
thread::spawn(move || {
let mut sorteing = "The quick red fox jumps over the lazy brown dog... tHE QUICK RED FOX JUMPS OVER THE LAZY BROWN DOG!!"[0..(i + 1) * 10]
.to_string();
let _sorteing_w = sorteing.wrap(format_args!("cool_data_{}", i));
unsafe { sorteing.as_bytes_mut() }.sort_unstable_by(|a, b| {
thread::sleep(Duration::from_millis(250));
a.cmp(b)
});
thread::sleep(Duration::from_secs(2));
})
})
.collect::<Vec<_>>();
for t in threads {
let _ = t.join();
}
}