/// If a global config instance has already been set.
#[inline]pubfnmake_global(self)-> &'staticSelf
{
set_global(self);
get_global()
//GLOBAL.get_or_init(move || self) // This isn't okay to do here. As it would silently fail if there was already an instance, when we want it to panic in that case.
}
/// Are we expected to dump data to `stdout`?
/// Are we expected to dump data to `stdout`?
#[inline]pubfnis_using_stdout(&self)-> bool
#[inline]pubfnis_using_stdout(&self)-> bool
{
{
@ -96,7 +161,7 @@ impl Default for Config
paths: Vec::new(),
paths: Vec::new(),
recursive: Default::default(),
recursive: Default::default(),
max_tasks: None,//max_tasks_cpus(),
max_tasks: None,//max_tasks_cpus(),
silent: false,
output_level: Default::default(),
#[cfg(feature="inspect")]
#[cfg(feature="inspect")]
serialise_output: None,
serialise_output: None,
}
}
@ -149,11 +214,19 @@ impl fmt::Display for InvalidConfigError
}
}
}
}
/// Print an error line in accordance with `Config`'s output directives.
/// Print an error line in accordance with `Config`'s output directives.
eprintln!("Size of vector ({} bytes, {} elements of {:?}) exceeds defer drop size floor {}. Moving vector to a seperate thread for de-allocation",len_bytes,vec.len(),std::any::type_name::<T>(),DEFER_DROP_VEC_SIZE_FLOOR);
cfg_eprintln!(Verbose;config::get_global(),"Size of vector ({} bytes, {} elements of {:?}) exceeds defer drop size floor {}. Moving vector to a seperate thread for de-allocation",len_bytes,vec.len(),std::any::type_name::<T>(),DEFER_DROP_VEC_SIZE_FLOOR);
Some(asyncmove{
Some(asyncmove{
tokio::task::spawn_blocking(move||drop(vec)).await.expect("Child panic while dropping vector");
tokio::task::spawn_blocking(move||drop(vec)).await.expect("Child panic while dropping vector");
})
})
@ -33,7 +34,7 @@ where T: Send + 'static
{
{
letlen_bytes=vec.len()*std::mem::size_of::<T>();
letlen_bytes=vec.len()*std::mem::size_of::<T>();
iflen_bytes>DEFER_DROP_VEC_SIZE_FLOOR{
iflen_bytes>DEFER_DROP_VEC_SIZE_FLOOR{
eprintln!("Size of vector ({} bytes, {} elements of {:?}) exceeds defer drop size floor {}. Moving vector to a seperate thread for de-allocation",len_bytes,vec.len(),std::any::type_name::<T>(),DEFER_DROP_VEC_SIZE_FLOOR);
cfg_eprintln!(Verbose;config::get_global(),"Size of vector ({} bytes, {} elements of {:?}) exceeds defer drop size floor {}. Moving vector to a seperate thread for de-allocation",len_bytes,vec.len(),std::any::type_name::<T>(),DEFER_DROP_VEC_SIZE_FLOOR);
eprintln!("Writing {} bytes of type {:?} to stream of type {:?}",vec.len(),std::any::type_name::<T>(),std::any::type_name::<W>());
cfg_eprintln!(Verbose;config::get_global(),"Writing {} bytes of type {:?} to stream of type {:?}",vec.len(),std::any::type_name::<T>(),std::any::type_name::<W>());