Closed minghuaw closed 6 months ago
This is only stabilized in 1.75 (rust-lang/rust#115822), would this be considered a breaking change?
Because of https://github.com/rust-lang/rust/issues/100013, a breaking release might be needed
Because of https://github.com/rust-lang/rust/issues/100013, a breaking release might be needed
Removing Send
bound for txn related traits kinda solves this problem, but this also means that the futures returned by those methods are not Send
, which should probably be considered a breaking change.
Removing Send bound for txn related traits kinda solves this problem, but this also means that the futures returned by those methods are not Send, which should probably be considered a breaking change.
When the issue is fixed, this will simply allow the future to be Send
again, which is more general and should not be considered breaking then.
The two traits that are affected by this are:
TransactionDischarge
in fe2o3-amqp
. The three async methods are not Send
AsyncCbsTokenProvider
in fe2o3-amqp-cbs
. The associated type Fut
is removed and get_token_async
returns impl Future
Because of rust-lang/rust#100013, a breaking release might be needed
Sender
is also affected. A breaking change is probably not enough, and v0.10.0 might need to wait for the issue
A breaking release seems not necessary at all now. The issue is (sort of) resolved in a weird way. Essentially, return position impl trait is used in trait declaration but async fn in trait is used in the trait implementation. ie.
pub trait AsyncTrait {
fn some_async_fn() -> impl Future<Output = ()> + Send;
}
struct Foo;
impl AsyncTrait for Foo {
async fn some_async_fn() -> () {
// ....
}
}
Implemented 0.9.4 and 0.8.27
Other crates have observed performance improvement after adopting this strategy (eg.
async-graphql
reports almost 20% performance gain).