(
state: &Rc<RefCell<OpState>>,
f: impl Future<Output = Result<T, twilight_http::Error>> + Send + 'static,
)
| 291 | } |
| 292 | |
| 293 | pub async fn discord_request<T: Send + Sync + 'static>( |
| 294 | state: &Rc<RefCell<OpState>>, |
| 295 | f: impl Future<Output = Result<T, twilight_http::Error>> + Send + 'static, |
| 296 | ) -> Result<T, AnyError> { |
| 297 | let rt_handle = { |
| 298 | let state = state.borrow(); |
| 299 | let rt_ctx: &RuntimeContext = state.borrow(); |
| 300 | rt_ctx.main_tokio_runtime.clone() |
| 301 | }; |
| 302 | |
| 303 | rt_handle |
| 304 | .spawn(f) |
| 305 | .await |
| 306 | .unwrap() |
| 307 | .map_err(|err| handle_discord_error(state, err)) |
| 308 | } |
| 309 | |
| 310 | pub async fn discord_request_with_extra_error<T: Send + Sync + 'static>( |
| 311 | state: &Rc<RefCell<OpState>>, |
no test coverage detected