async-broadcast
async-broadcast copied to clipboard
WASM support
I get this error when trying to build for wasm:
Compiling async-broadcast v0.7.1
error[E0599]: no method named `wait` found for struct `SendInner` in the current scope
--> /home/flupke/.cargo/registry/src/index.crates.io-6f17d22bba15001f/async-broadcast-0.7.1/src/lib.rs:1647:1
|
1647 | / easy_wrapper! {
1648 | | /// A future returned by [`Sender::broadcast()`].
1649 | | #[derive(Debug)]
1650 | | #[must_use = "futures do nothing unless .awaited"]
1651 | | pub struct Send<'a, T: Clone>(SendInner<'a, T> => Result<Option<T>, SendError<T>>);
1652 | | pub(crate) wait();
1653 | | }
| |_^ method not found in `SendInner<'_, T>`
1654 |
1655 | / pin_project! {
1656 | | #[derive(Debug)]
1657 | | struct SendInner<'a, T> {
1658 | | sender: &'a Sender<T>,
... |
1665 | | }
1666 | | }
| |_- method `wait` not found for this struct
|
= help: items from traits can only be used if the trait is implemented and in scope
= note: the following trait defines an item `wait`, perhaps you need to implement it:
candidate #1: `Strategy`
= note: this error originates in the macro `easy_wrapper` (in Nightly builds, run with -Z macro-backtrace for more info)
which is caused by this in the event-listener-strategy
crate:
/// Wait for the future to complete, blocking the current thread.
///
/// This function uses the [`Blocking`] strategy to poll the future until it is ready.
///
/// The future should only return `Pending` if `Strategy::poll` returns error. Otherwise,
/// this function polls the future in a hot loop.
#[cfg(all(feature = "std", not(target_family = "wasm")))]
#[cfg_attr(docsrs, doc(all(feature = "std", not(target_family = "wasm"))))]
fn wait(mut self) -> Self::Output
where
Self: Sized,
{
// SAFETY: `self`/`this` is not moved out after this.
let mut this = unsafe { Pin::new_unchecked(&mut self) };
loop {
if let Poll::Ready(res) = this
.as_mut()
.poll_with_strategy(&mut Blocking::default(), &mut ())
{
return res;
}
}
}
Do you think it would be possible to add WASM support behind a feature flag, or is this fundamentally needed?