The current implementation is based on a loop that breaks as soon as a job status is reached.
Instead this should be implemented using the Future trait.
A possible interface would be something like the following:
async fn async_fn() {
// hit endpoint
// check status
// return true if ready, else false
}
const fut = EndpointPoll {
op: async_fn
}
let result = fut.await?;
Major blocking issue is how to type the op field of EndpointPoll struct. That's a function pointer to an async function. It requires the use of the Pin trait but I'm unsure how this can be done.
The current implementation is based on a
loop
thatbreak
s as soon as a job status is reached. Instead this should be implemented using theFuture
trait.A possible interface would be something like the following:
Major blocking issue is how to type the
op
field ofEndpointPoll
struct. That's a function pointer to an async function. It requires the use of thePin
trait but I'm unsure how this can be done.