px_wsdom_javascript/
misc_impl.rs1use core::future::IntoFuture;
2
3use crate::{Promise, PromiseLike};
4
5use super::Array;
6use wsdom_core::{r#await::Await, Cast, JsCast, ToJs};
7
8impl<'a, T, U, const N: usize> ToJs<Array<T>> for [&'a U; N]
9where
10 T: JsCast,
11 U: ToJs<T>,
12{
13}
14macro_rules! promise_like {
15 ($pr:ident) => {
16 impl<T: JsCast> IntoFuture for $pr<T>{
17 type Output = T;
18
19 type IntoFuture = Cast<Await,T>;
20
21 fn into_future(self) -> Self::IntoFuture {
22 Cast{
23 value: self.0.into_future(),
24 phantom: core::marker::PhantomData,
25 }
26 }
27 }
28 };
29}
30promise_like!(PromiseLike);
31promise_like!(Promise);