Skip to content

Add smol and async_global_executor runtime -- question "how to" in almost prepared PR #3787

Closed
@martin-kolarik

Description

@martin-kolarik

I have found these related issues/pull requests

I would like to have these in sqlx: 1) smol as a replacement for async_std, and 2) async_global_executor as a less bulky approach. Both use the same internals.

The reason for having both is that both create own static executor, which would end in creating extra thread pool for users using async_global_executor, if sqlx supported smol only.

Description

I have implemented this addition in my fork, but I stopped at forbid(unsafe_code)], because the code requires unsafe:

fn try_read(&mut self, buf: &mut dyn ReadBuf) -> io::Result<usize> {
    unsafe { self.get_mut().read(buf.init_mut()) }
}

It is explained at Async.

Also, I started with fork a month ago, but yesterday async_std become discontiued (https://crates.io/crates/async-std), what added a motivation.

Prefered solution

I think the best solution would be to extract sqlx_rt to separate crate that would allow unsafe for smol and async_global_executor. But, I would like to discuss it first with sqlx owners.

Is this a breaking change? Why or why not?

No, only extending the range of executors.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions