aleym_core 0.1.0-alpha.1

Extensible news aggregation and knowledge-base engine (Core Library Component of Aleym)
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
pub fn spawn_cpu_blocking<F, T>(f: F) -> tokio::sync::oneshot::Receiver<T>
where
	F: FnOnce() -> T + Send + 'static,
	T: Send + core::fmt::Debug + 'static,
{
	let (send, recv) = tokio::sync::oneshot::channel();

	let thread_span = tracing::trace_span!(parent: tracing::Span::current(), "RayonThread");

	rayon::spawn(move || {
		thread_span.in_scope(|| {
			send.send(f()).unwrap();
		});
	});

	recv
}