Skip to content

Define ConditionalSend #2658

Open
@heaths

Description

@heaths

We have a lot of places in code where we use a condition on target_arch = "wasm32" (though, most should probably be target_family = "wasm") to constrain to Send but this requires a lot of boilerplate code. Instead, we could define a trait (typedefs don't work in all places) like bevy does, though probably using distinct mods e.g.,

#[cfg(target_arch = "wasm32")]
mod conditional_send {
  pub trait ConditionalSend {}
  impl<T> ConditionalSend for T {}
}

#[cfg(not(target_arch = "wasm32"))]
mod conditional_send {
  pub trait ConditionalSend: Send {}
  impl<T: Send> ConditionalSend for T {}
}

pub use conditional_send::*;

We'd need to go through and find all the places necessary. We'd have to leave async_trait in place with a conditional Send but many other places would be cleaned up.

Metadata

Metadata

Assignees

No one assigned

    Labels

    Azure.CoreThe azure_core crateClientThis issue points to a problem in the data-plane of the library.

    Projects

    Status

    Untriaged

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions