use crate::subripfile::SubtitleError;
pub async fn run_blocking<T, F>(task: F) -> Result<T, SubtitleError>
where
T: Send + 'static,
F: FnOnce() -> Result<T, SubtitleError> + Send + 'static,
{
tokio::task::spawn_blocking(task)
.await
.map_err(|error| SubtitleError::Parse(format!("Async task failed: {error}")))?
}