#[cfg(any(feature = "vector", feature = "fulltext"))]
use linkrs_core::error::QueryError;
#[cfg(any(feature = "vector", feature = "fulltext"))]
pub(crate) fn wait<F, T, E>(label: &str, future: F) -> Result<T, QueryError>
where
F: std::future::Future<Output = Result<T, E>> + Send,
T: Send,
E: Send + std::fmt::Display,
{
let label = format!("{label} failed");
linkrs_sync::runtime::block_on_ambient(future)
.map_err(|error| QueryError::execution(format!("{label}: {error}")))?
.map_err(|error| QueryError::execution(format!("{label}: {error}")))
}